Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Legal symbol names and generics

Reply
Thread Tools

Legal symbol names and generics

 
 
John Lam
Guest
Posts: n/a
 
      11-24-2005
------=_Part_23522_21841397.1132849399348
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I've just started thinking about generics in my Ruby <=3D> CLR bridge. This=
is
what I'd love to be able to do:

channel =3D ChannelFactory<IOutputChannel>("
http://www.flickr.com/services/soap/").CreateChannel

The problem is how to deal with the stuff in angle brackets since < and >
are not legal inside of Ruby constants. Any thoughts on how to syntacticall=
y
deal with this issue?

Thanks
-John
http://www.iunknown.com

------=_Part_23522_21841397.1132849399348--


 
Reply With Quote
 
 
 
 
John Lam
Guest
Posts: n/a
 
      11-24-2005
------=_Part_23868_14854001.1132851731441
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Whoops, that should be:

channel =3D ChannelFactory<IOutputChannel>("
http://www.flickr.com/services/soap/").new.CreateChannel<http://www.flickr.=
com/services/soap/%22%29.CreateChannel>

-John
http://www.iunknown.com

------=_Part_23868_14854001.1132851731441--


 
Reply With Quote
 
 
 
 
Marcin Mielżyński
Guest
Posts: n/a
 
      11-24-2005
it is legal (just use another symbol construction literal):

x = :"< ... >"
p x

lopex

John Lam wrote:
> I've just started thinking about generics in my Ruby <=> CLR bridge. This is
> what I'd love to be able to do:
>
> channel = ChannelFactory<IOutputChannel>("
> http://www.flickr.com/services/soap/").CreateChannel
>
> The problem is how to deal with the stuff in angle brackets since < and >
> are not legal inside of Ruby constants. Any thoughts on how to syntactically
> deal with this issue?
>
> Thanks
> -John
> http://www.iunknown.com
>

 
Reply With Quote
 
John Lam
Guest
Posts: n/a
 
      11-24-2005
------=_Part_24004_31749685.1132852497918
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: base64
Content-Disposition: inline

QWgsIHNvIGl0IGlzLCBidXQgaWYgSSBvdmVycmlkZSBPYmplY3 QuY29uc3RfbWlzc2luZywgSSBz
dGlsbCBoYXZlIHRoZQpwcm9ibGVtIHdpdGggdGhlIFJ1YnkgaW 50ZXJwcmV0aW5nIHRoZSA8IGFu
ZCA+IGNoYXJhY3RlcnMgOigKCi1Kb2huCmh0dHA6Ly93d3cuaX Vua25vd24uY29tCgoKCgpPbiAx
MS8yNC8wNSwgTWFyY2luIE1pZWy/efFza2kgPGxvcGV4eEBhdXRvZ3JhZi5wbD4gd3JvdGU6Cj4K
PiBpdCBpcyBsZWdhbCAoanVzdCB1c2UgYW5vdGhlciBzeW1ib2 wgY29uc3RydWN0aW9uIGxpdGVy
YWwpOgo+Cj4geCA9IDoiPCAuLi4gPiIKPiBwIHgKPgo+IGxvcG V4Cj4K
------=_Part_24004_31749685.1132852497918--


 
Reply With Quote
 
Marcin Mielżyński
Guest
Posts: n/a
 
      11-24-2005
oops...

I thought You're writing about symbols

lopex
 
Reply With Quote
 
John Lam
Guest
Posts: n/a
 
      11-24-2005
------=_Part_24124_21146761.1132853325776
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: base64
Content-Disposition: inline

U29ycnkgYWJvdXQgdGhlIG1pc2xlYWRpbmcgc3ViamVjdCA6KS BJIGp1c3QgbmVlZCB0byBmaWd1
cmUgb3V0IGEgd2F5IG9mCnRyYW5zbWl0dGluZyBzb21lICJ0eX BlIGluZm9ybWF0aW9uIiBpbiBh
IGNvbnN0YW50IG5hbWUgLSBlZmZlY3RpdmVseSBhIGZvcm0Kb2 YgbmFtZSBtYW5nbGluZyBzbyB0
aGF0IEkgY2FuIGNvbnN0cnVjdCB0aGUgY29ycmVjdCBwcm94eS 4KClRoYW5rcywKLUpvaG4KaHR0
cDovL3d3dy5pdW5rbm93bi5jb20KCgpPbiAxMS8yNC8wNSwgTW FyY2luIE1pZWy/efFza2kgPGxv
cGV4eEBhdXRvZ3JhZi5wbD4gd3JvdGU6Cj4KPiBvb3BzLi4uCj 4KPiBJIHRob3VnaHQgWW91J3Jl
IHdyaXRpbmcgYWJvdXQgc3ltYm9scyA7KQo+Cj4gbG9wZXgKPg o+Cg==
------=_Part_24124_21146761.1132853325776--


 
Reply With Quote
 
David A. Black
Guest
Posts: n/a
 
      11-24-2005
Hi --

On Fri, 25 Nov 2005, John Lam wrote:

> Ah, so it is, but if I override Object.const_missing, I still have
> the
> problem with the Ruby interpreting the < and > characters


I think constant names with < and > would be so hard to read for
humans that Ruby is right to make them impossible

How would you (or Ruby) interpret:

class A
end

class B<A
end

or:

puts "Yes" if Object>String

?

(You can take that as a rhetorical question


David

--
David A. Black



 
Reply With Quote
 
David A. Black
Guest
Posts: n/a
 
      11-24-2005
Hi --

On Fri, 25 Nov 2005, John Lam wrote:

> Sorry about the misleading subject I just need to figure out a
> way of
> transmitting some "type information" in a constant name -
> effectively
> a form of name mangling so that I can construct the correct proxy.


Maybe you should use nested constants (using :.


David

--
David A. Black



 
Reply With Quote
 
John Lam
Guest
Posts: n/a
 
      11-24-2005
------=_Part_24352_5011535.1132853971481
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thanks David, I wasn't really thinking about those corner cases at all
(reveals the tunnel vision that I have right now).

Are there *any* characters that I can use in Ruby to escape the type
information in the constant name?

Thanks
-John
http://www.iunknown.com

------=_Part_24352_5011535.1132853971481--


 
Reply With Quote
 
ts
Guest
Posts: n/a
 
      11-24-2005
>>>>> "J" == John Lam <> writes:

J> Are there *any* characters that I can use in Ruby to escape the type
J> information in the constant name?

What is the type information ?

Guy Decoux


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Encryption Package) error: cannot find symbol symbol: class BaseNCode clusardi2k@aol.com Java 6 08-29-2012 08:33 PM
generics depending on generics Soul VHDL 0 02-02-2009 09:14 AM
Why ":symbol" failed but 'symbol' successed with JRuby 1.0.3? Song Ma Ruby 2 07-20-2008 04:08 AM
Can't convert a generics list of objects into a generics list ofinterfaces Juergen Berchtel Java 1 05-20-2005 02:07 PM
what's differnece between #ifdef symbol and #if defined(symbol) baumann@pan C Programming 1 04-15-2005 08:25 AM



Advertisments