MiniD 1.0 released!

Chris Nicholson-Sauls ibisbasenji at gmail.com
Sat Aug 4 17:09:25 PDT 2007


Jarrett Billingsley wrote:
> "Christopher Wright" <dhasenan at gmail.com> wrote in message 
> news:f926br$2a08$1 at digitalmars.com...
>> Is there any chance of support for optional strong typing? That's my main 
>> beef with Javascript; the one time I've used it for a production system, 
>> it took six hours to do something that would have been fifteen minutes 
>> with strong typing (due to a single bug), and I never did accomplish what 
>> I set out to do.
>>
>> At least function arguments should be typed, or typeable, in an 
>> object-oriented language. Lua doesn't need strong typing as much because 
>> it only has primitives, functions, and tables. But MiniD is 
>> object-oriented, and the only alternative to typing is reflection.[1] 
>> Maybe some sort of 'where' clause?
>> function do_stuff(arg1, arg2) where arg2 : ExpectedClass {}
> 
> I think you must have been reading my personal design notes :)  Function 
> parameter type constraints is a feature I've been considering for v2.0. 
> They'd look something like this:
> 
> function f(x : int, y : !int, z : int | float, w : instanceof Foo) { ... }
> 
> x : int means only ints are allowed; y : !int means anything _but_ ints; z : 
> int | float means z can take an int or a float, and w : instanceof Foo means 
> it has to be an instance of class Foo (or any class derived from it).

This looks very nice to me.  Actually, the internal language for a 
project of mine does something slightly similar.  (I hadn't accounted 
for the case you solve with ": int|float"... might have to borrow that. 
  And the last case would be just ": #Foo".)

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list