Latest const expansion
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Wed Sep 12 18:04:59 PDT 2007
Bill Baxter wrote:
> Regan Heath wrote:
>> const(T) indicates both head/tail const
>> const(*T) indicates tail const
>> const(&T) indicates head const
>
That's pretty much a horrendous syntax, and I hope I'm not the only to
think that.
> I think this befuddles the nice clean idea of const(...) as a type
> constructor that takes the type inside the parens and makes a new
> const-ified type out of it.
>
> But fortunately that cleanness can be reclaimed by thinking instead of a
> _family_ of type constructors, which do head/tail/full const of their
> argument. In short, just move the symbol out of the parens so the thing
> inside the parens remains a valid type.
>
> const(T) - type constructor making both head/tail const version of T
> const*(T) - type constructor making tail const version of T
> const**(T) - type constructor making tail-of-tail const version of T
>
> [..and now we're back to what I think was Janice's suggestion many many
> posts ago, which I liked then too.]
>
Yes, I like this better too. The '*'s are not mixed the 'T', which is
better. But like I mentioned in Janice's thread, I think it would be
even better to have this:
final const(T) - head/tail const
const(T) - tail const
... and tail-of-tail const would not be supported, at least not with a
native syntax. I don't see much use for it, so let's keep it simple (but
should there be a use, such a construct could be made with
meta-programming anyway).
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list