On 20/08/2012, at 3:46 PM, Dobes Vandermeer wrote: > > The keyword "fun" is used to define functions, it may be suitable for this as > well. If you allow one to define a type of function that takes no parameter > and doesn't require any parameter (not even unit) to be passed: > > fun x => y + z; > fun y => 3; > fun z => 7;
You can already do this (with that syntax). As you expect this is lazy. So why have vals as they are? Because they're eager OR lazy. It isn't specified. This leads to best performance and it makes no difference most of the time. It can't lead to different results unless you involve pointers (vars) or eager evaluation would crash. So the idea is you have three kinds: eager lazy unspecified > > You'd probably back on better footing as this is pretty clear in terms of > what you are doing. People would be surprised if these functions are > evaluated eagerly, though - so you'd still be a bit stuck. You could add an > adjective for people to enable this flexibility, like "pure": > > pure fun x => y + z; Pure is already implemented (for functions). > > The "pure" would be a promise to the compiler that the function can be > evaluated at will without any change in semantics, whether to advance, defer, > repeat, or eliminate evaluation. Unfortunately no, you would need this instead: pure total fun .... Division is pure .. it isn't total. > I don't think there are a lot of people running away from C++ because it is > too slow ... I certainly haven't noticed that. There are lots of people refusing to use C and C++ because it is too slow: most of the HPC (High Performance Computing) community. They still use Fortran. > Ah I suppose I wasn't thinking of it as a kind of "tinkering around in the > back yard" kind of thing when I first encountered, but I'm increasingly > realizing that is what this is, and what the drawbacks of using such a thing > might be. Good. Flexibility has drawbacks. Lack of stability is one. It's a good argument against Felix and in favour of C. Or perhaps Java, since that doesn't change much. We don't need stability yet, or robust semantics: there aren't enough users/developers to be worried about backward compatibility etc. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language