Growing a Language (applicable to @attribute design)

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 14 03:09:26 PST 2012


On Wednesday, November 14, 2012 12:06:29 Simen Kjaeraas wrote:
> On 2012-43-14 11:11, Walter Bright <newshound2 at digitalmars.com> wrote:
> > On 11/14/2012 1:49 AM, renoX wrote:
> >> That's not strictly true: type inference works better for built-in
> >> types than
> >> for user-defined types, with "auto x = 1;" x is an int, how do I have
> >> the same
> >> type of syntax for MyInt?
> > 
> > You can have user-defined literals in D:
> >     auto x = MyInt(1);
> 
> But the syntax for built-in types is better, in that you don't need to
> write:
> 
> auto x = int(1);

That's only because built-in types have literals built into the language. The 
type deduction is identical either way. It sounds like your complaint has 
nothing to do with type deduction then but rather with the fact that literals 
for user-defined types aren't as pretty as those for the built-in types.

- Jonathan M Davis


More information about the Digitalmars-d mailing list