[just talk] what if implicitly typed literals were disallowed

Adam D. Ruppe destructionator at gmail.com
Wed Oct 24 15:55:36 PDT 2012


On Wednesday, 24 October 2012 at 19:00:03 UTC, Timon Gehr wrote:
> I'd miss ifti on literals.

Yeah, that'd be a total sucl.

> If your goal is to be able to customize the
> type of literals from druntime, it is also possible to make the 
> compiler
> invoke some predefined templates/functions in order to transform
> literals to an arbitrary library-defined type.

OOooh, I like it. Then kill off the keywords while you're at it 
and boom.

alias _int int;
/* repeat for the rest */

template __d_literal(T, T value) {
     alias value __d_literal;
}

and you have the current behavior, but complete customization 
potential. That's potentially awesome. You could even wrap 
literals just to identify them and overload functions on them.

whoa i kinda want.


More information about the Digitalmars-d mailing list