Is the world coming to an end?

Nick Sabalausky a at a.a
Sun Apr 3 10:57:54 PDT 2011


"Michel Fortin" <michel.fortin at michelf.com> wrote in message 
news:ina7e9$2kdh$1 at digitalmars.com...
> On 2011-04-03 12:04:42 -0400, Adam D. Ruppe <destructionator at gmail.com> 
> said:
>
>> btw, it might be worth considering a change to overflow. Suppose
>> there was a way to get arbitrary size ints passed to a template.
>> Then, the library could do its own overflow checks, or not, enabling
>> things like bigint literals in this same fashion.
>>
>> Though, I don't think it's a big benefit. It'd be really weird
>> to use (a new compile time only datatype?)
>
> I've been thinking about the same thing, except instead of having a 
> special data type the template would simply take a string:
>
> template binary(string digits) {
> ...
> }
>
> binary!1111_1111_0000_0000;
> // no error, number "1111_1111_0000_0000" passed as a string to the 
> template.
>

I've always thought that we should be able to do something like this:

template foo(int val)
{
    enum foo = val.meta.argString;
}
static assert(foo!(2+3) == "2+3");




More information about the Digitalmars-d mailing list