Re: ':' in type names ?



On 28 Aug 2001, Martin Baulig wrote:

> Tim Janik <timj gtk org> writes:
>
> > the type system currently just allowes [A-Za-z0-9+_-] for type names,
> > and assumes that '-' == '+' == '_', i.e. these characters are not going
> > to be used to make two type names distinct, so LBs can do s/[+-_]/_/ or
> > s/[+-_]/-/, depending on what is appropriate.
> > as to why not allowing other characters in type names, think of LBs
> > mapping type names into language symbols, e.g. C++:
> > class Martin:Baulig { } simply isn't going to work (Martin:Baulig
> > is _not_ one identifier, whereas Martin_Baulig is).
>
> Hmm, but where's the difference between '-', '+' and ':' - all of them are
> not allowed in C or C++ type names.
>
> Can't C++ or C just map s/[+:_-]/_/ ?
>
> Btw. my problem with the ':' is that I think that '+', '-' and '_' look very
> weird in a CORBA type name - and I'm using it in a scripting language which
> normally uses '-' to separate words in indentifiers 'foo-test-string'. So
> I wanted to use CORBA names like 'Bonobo:PropertyBag:getValue' or
> 'Bonobo:ActivationResultType:activation-result-object' - where
> 'Bonobo:ActivationResultType' is the type name.

I also asked about this a while back.  For python, it would be very useful
to be able to use the fully qualified class name for new GObject
subclasses (modulename.classname), but couldn't because the '.' isn't
allowed in a typename.

To me, the limitation on characters in typenames seems very arbitrary.
For python, I would already need to do some type of mangling to make sure
an identifier is in python (as well as character substitutions, it might
be necessary to check if it collides with a keyword, etc).  I think almost
all languages would require some form of mangling to make sure an
identifier was safe.

Having more possible allowable characters isn't going to make that much of
a difference.  I could understand disallowing double colons in a typename
though, as '::' has a special meaning in many strings in gtk
(signa::detail, type::property, etc).

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]