From: Logan Capaldo Date: 2007-06-26T00:06:46+09:00 Subject: Re: Q: how to start a module name with a lower case character? ------=_Part_104033_28261550.1182784006759 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/25/07, Mark Watson wrote: > > I am trying to write Ruby classes to model RDF, RDFS, and Owl, much > like SWCLOS does for Common Lisp: > > module Rdfs > ... > end > > x = Rdfs::Class.new(Rdfs::Label => "label_1") > > It would be nice to have a hack that would allow module names to start > with a lower case letter. Any ideas? > > It would also be good to be able to alias "::" to ":" so that I could > use a syntax like: > > rdfs:Label > > Any ideas and references to things to read, no matter how hack-like, > will be appreciated. > > > I can think of two hacks, one to get lowercase module names, and one to get a single colon, but they aren't compatible with each other: Lowercase module name: rdfs = Module.new do ... code ... end (Note that rdfs is a local variable, with all the attendant scoping issues) rdfs:Label syntax: module Rdfs ... code ... end def rdfs( name ) Rdfs.const_get(name) end rdfs:Label # yuck You know if you really want to make look just like the syntax you want, you can use strings. I would not recommend abusing ruby to the extent you would have to almost acheive what you want. ------=_Part_104033_28261550.1182784006759--