Re:Felix - a fast scripting language
by jaipilot747 on Friday January 04, 2013 @04:00PM
(#5009858)
How is
or even
better than a plain int[5]? To me, the use of mathematical operators * and ^ causes dissonance.
[ Parent
| on HN ]
Re:Felix - a fast scripting language
by munificent on Friday January 04, 2013 @04:39PM
(#5010110)
If you're coming from a type theory background (which, granted, few are), this operator is actually perfectly natural.
Re:Felix - a fast scripting language
by andrewflnr on Saturday January 05, 2013 @12:58AM
(#5011824)
I don't come from much of a type theory background. I certainly have no formal education in the field. I just know how a Cartesian product works, and that's enough to make me get it.
Re:Felix - a fast scripting language
by lambdaphage on Saturday January 05, 2013 @12:02AM
(#5011682)
Aren't product types just tuples, whereas arrays correspond to list types? The '^' operator can only construct arrays whose elements are of a single type, right?
That's correct. However, somewhat problematically, Felix considers the tuple int * int to actually be an array int ^ 2. It's not entirely clear this "automatically applied isomorphism" is a good idea though. However it means arrays "drop out" of the notion of a tuple as a special case.
Internally such arrays have a special representation which allows arrays of 100,000 values, something which could never be represented by a tuple type (and still get reasonable compile times :)