On 08/11/2010, at 4:56 AM, Lenny222 wrote:

>> Last time (whatever that means) we got a few interested people that
>> ALL wanted something weird: one wanted classes, one wanted to
>> do serious stuff on Windows which we could barely support,
>> etc ..and I ended up doing 10 different things at once trying
>> to accomodate them.
> 
> I am not such much interested in purely theoretic concepts and ideas.
> To me Felix seems good enough and only needs more libraries and
> documentation to be more interesting for the real world.


Well, I am interested in "pure" ideas/theory because I think it helps
get a nice clean "orthogonal" design ..as well as making the implementation
simpler.

For example there's "if it looks like a function and quacks like a function
then it is a function". Don't try this in Ocaml:

type t = | X of int
let f g x = g x in
match f X 1 with X i => print_endline i
;;

It won't work, because X isn't a function, its a type constructor.
Sure, you can do

let X_wrapper i = X i in
match f X_wrapper 1 with ...

and that will work. Felix does this automatically: this works:

union t = | X of int;
fun f (g:int->t) (x:int) => g x;
println$ match f X 1 with | X ?i => i endmatch;

In fact, Ocaml is simpler and purer here, what Felix does
is a hack (X really isn't a function). It's a very interesting question
what to do with constructors of "no" arguments. In principle these
do not exist. For example

type boolean = True | False

Really, these are constructors and have to take a unit argument (),
but then you'd be writing

   (True ())

everywhere. So Ocaml, and Felix, hack it. And so in that case,
in both languages, you have to use a wrapper to pass it
as a function.

This kind of issue IS important when you're doing higher order type
of stuffs.. handling special cases is a serious hassle.

Just consider C++ template with this code in it:

return x;

where x is type T and consider the substitution T->void.
Originally you couldn't do this.. I think that has been changed
because if you don't allow it you require two templates,
one for non-void and one for the void case, just to handle
the fact that return argument has to be used for non-void
and plain return if the argument type is void.

Maybe two isn't a bad number .. but if you have a template
of 3 arguments you now need 2^3=8 templates .. just because
of a non-orthogonal syntax.

Same problem exists with const/non-const (and volatile) pointers,
which is why the committee (stupidly IMHO) provided a way to 
access the "constness" of a type, to save the template-meta-programming
hackers from massive duplication.

Anyhow, this one is a non-trivial and important issue for Felix because Felix
does not have any support for "const" or "volatile" .. despite the fact it
is supposed to be designed to be good at binding to C.


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to