Is the world coming to an end?

Michel Fortin michel.fortin at michelf.com
Sun Apr 3 09:28:38 PDT 2011


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.

But the bigger problem is that it doesn't scale beyond base 10:

	template hex(string digits) {
		...
	}

	hex!ABCDEF00;
	// isn't ABCDEF00 an identifier?

So it wouldn't bring us much when it comes to parsing different bases, 
even though it could be used for other things.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list