On 23/08/2014, at 3:36 AM, srean wrote:

> Ah, ok. The pattern match in the let expression had me puzzled. I would have 
> expected
> 
> let x = 1 in x + x

That works in Ocaml ..
> 
> so was wondering, whats with the pattern matching. Is the pattern matching 
> syntax required in all let expressions in Felix ?

But not in Felix. This is because Ocaml uses CamlCase: variables start
with lower case, constructors with upper case. I consider that unacceptable
in an I18n setting, and a serious problem if you're modelling, say, C or C++ 
code
with similar names.

So we need the ? in a pattern match to indicate the pattern variables.
ATS, however, uses a different method I have half implemented
It notes that in a pattern

        C x

the C has to be a constructor. In ATS there are no argument-less constructors.
For example the true constructor must take a unit argument:

        true ()

Therefore, it is always possible to tell which symbol is a constructor
and which is a variable name in ATS. In fact this is more logical
than Ocaml/ML and Felix which has constant constructors
(which are in effect constructors taking a void argument, rather than a unit 
argument).

Anyhow, for the moment you need ?variable.

> 
> For some reason I had missed let expressions entirely. I wasn't even aware 
> that they were supported.

That's because you're not writing code. Instead you're reading documentation
which is known to be incomplete.

If you wrote and published some code I could fix it
for you and you'd learn something, and then you could 
help fix the documentation I have no time to do.

Just as an aside: writing docs for Felix is daunting for me.
It's not that I'm not so good at it (I'm not), but the fact it isn't
a conventional language. The grammar is part of the library,
so there's no way to correctly "document the syntax" because
Felix doesn't have any syntax (apart from the statements used
to define the grammar :)

Furthermore some of the syntax in the grammar is a bit arcane:
to be technically correct I would have to explain, for example,
that a polymorphic thingo can have a list of types with constraints
that can be present in 3 different ways, as well as and in addition
to typeclass constraints (which are unrelated). 

When you throw in the need to understand that Felix isn't
just the "flxg" compiler, but also depends on the RTL and
standard library. For example the compiler has no idea
what an fthread or schannel is: they're defined in the RTL.
The compiler just knows what a service call is.

Then you'll ask: what types does Felix have? And the answer
is .. well NONE. "int" is not a Felix type. Its a binding in the library.
OK, so what operators does "int" support?

Thats a hard question. You can do + and - and * and / and %
of course, but really you're asking: give a list of every function
in the library for which one of the arguments happens to be
an int. That's absurd. So where do I stop?

If you want an actual specification, then you will learn
how the grammar is defined and how bindings to C
are created, and what type *combinators* the compiler
supports: products, sums, records, unions, pointers, arrays.

Perhaps you see why its so hard to document.
There are no clear boundaries between things.
An expert CANNOT write the documentation because the
expert knows too much. The best docs have to be written
by novices.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to