Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Comment Re:And replace them with what? (Score 1) 29

Addendum

I'd prefer "req" over "required" as it would be used often: frequent tokens/idioms should be short. And "str" instead of "string".

One could put ranges and other decorations, perhaps custom ones:

var x:num.range(0, 99.99);
var s:str.maxLen(12);
var s:maxLen(120); // shorter version of above, strings don't need explicit types.
var u; // untyped, but treated as string by default
var foo=7; // automatically "int" based on constant.
var fi=7.0; // automatically num (decimal*)

(Variable declarations and parameter declarations use similar conventions)

* Treated as decimal by default, but big exponents will automatically bump its storage from 16 bits to 64 bits.

Comment Re:And replace them with what? (Score 1) 29

For one, get away from C-based syntax, at least the ugly parts. Second, don't overload "+" for both concatenation and math (Js); that was bigly stupid. Third, give us optional named parameters. Anonymous objects are not a good substitute. Fourth, clean up name-space management instead of using a hacked-on "fix".

Example function declaration:

func myFunc(aa, bb:int, cc:num.required, dd:required, ee:int=7) {...}

This example is "semi-typed" as "aa" doesn't require a type (is not validated). "dd" doesn't require a type but can't be white-space-only or null. "ee" is initialized with "7" if not passed in a call or is blank/null.

I've yet to find a newer language that has all the features listed.

Slashdot Top Deals

DEC diagnostics would run on a dead whale. -- Mel Ferentz

Working...