MichaelRFairhurst / wake-compiler

C++ compiler for the programming language Wake: a fast, expressive, typesafe language built with testability from the ground up.
https://cdn.rawgit.com/MichaelRFairhurst/wake-compiler/docs/index.html
MIT License
56 stars 7 forks source link

Proposal: array access if array exists #86

Open MichaelRFairhurst opened 10 years ago

MichaelRFairhurst commented 10 years ago
var Num?[] = [];
return Num?[0];

or something. Should be combinable with [?x] typesafe array access, ie

var Num[][] = [];
return Num[?0]?[?1];
// get Num[0,1] or nothing

which breaks down as

Although it'd be nice if it were prettier than Num[?0]?[?1] :)

MichaelRFairhurst commented 10 years ago

Maybe it should be Num[0?][?0?]

MichaelRFairhurst commented 9 years ago

Why not .get() and .getSafe()? Make this a library problem.