On 26/12/2012, at 5:01 PM, Dobes Vandermeer wrote:
> I think the #true thing is not bad. It may be worth considering treating
> special cases like that as if "true" were a boolean literal rather than an
> identifier, and doesn't require a parameter.
true already is a boolean literal: the *parser* translates it to
case 1 of 2
which is a literal value of a sum type. The problem is its an argument-less sum
type.
So in this case if I change the rules, so constant constructors are eliminated,
that is, what is effectively:
union bool = | False of void | True of void
is banned and you have to do:
union bool = | False of unit | True of unit
then you would have to write:
True () // or equivalently #True
when you needed a value. But now if you had to do that in patterns
as well .. well the parser could just translate
true => (True ())
Now I always considered it a wart that Ocaml has constant and non-constant
constructors,
instead of just non-constant constructors some of which take unit argument,
although
it does make the syntax cleaner, it makes the distinction between the
constructor
and the value it constructs impossible to spell. Whereas it is clear for
non-constant
constructors.
however now I am not too sure! Consider the analogue for ordinary values.
We're saying
var x = 1;
Hey, there's no such thing as a "variable of no arguments"
and "there's no such thing as a value of no arguments".
Now actually this idea has GREAT MERIT. In Haskell it is called
point free programming, in my terms it is categorical programming:
you deal exclusively with functions, and you deal entirely with
composition: there's no application because there are no values.
So for example:
x . sin
is not considered applying sin: double -> double to x: double,
nope, its considered to be a composition of sin with
x: unit -> double
The best known compositional language is Forth (aka Postscript).
Composition is cool because it is an associative operator: application
is not. Application sucks because when you have values you have
to abstract them, and so you need lambda binders. Which suck.
All that crud goes away when you use composition
(but of course you get new crud instead ;) :)
Anyhow, this is why I'm just not sure.
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language