On Fri, 2006-09-08 at 20:35 -0400, Peter Tanski wrote:
> On Sep 8, 2006, at 7:32 PM, skaller wrote:
>
> > The reason for = in some places is purely syntactic:
> > { .. } is a valid expression. So for functions:
> >
> > fun f():int { ... }
> >
> > is not a possible syntax, because it would mean:
> >
> > fun f(): _apply(int,{ ... })
> > ...
> >
> > If you think this is messy .. heck, I agree!
>
> Oh no, it wasn't another dig on syntax :)
Peter -- there is nothing wrong with having a dig at
the syntax. Syntax is important to programmers.
The syntax of Felix evolved. Some is cute and some
is a severe mess and needs to be fixed.
I do not think there is a problem redesigning it,
it isn't as if we have 100K users out there that will
scream .. I mean, the C++ committee changed things and
they DID have 100K users out there screaming :)
The basic policy is set by users not me .. well there
aren't many so I get a say. My concept is to keep
the marks and twiddles enough like C++ that C++ people
can read the code and won't be put off by arcane syntax.
I've been looking at Haskell code for some time now,
and I'm only just getting enough of it internalised
I can parse it ..
Anyhow given that basic idea -- plus the fact that
I decided at the outset to scrub the C++ type notation --
I'm not against quite significant redesign of the syntax.
> > As to overriding and virtual functions: Haskell already
> > allows a default definition, doesn't it?
> It would make the Felix implementation simpler (but not nearly as
> convenient) if users were required to explicitly define the typeclass
> functions for each instance--
I'm not against starting simple and enhancing later. Sound good.
But -- and you must promise not to scream here -- the
'most important' use of typeclasses is actually to automate
wrapping C++ types. In this case 'the whole point' is
in the defaults:
typeclass Iterator[i,t] {
proc advance: i = "++$1";
fun deref: i -> t = "*$1";
fun eq: i * i -> 2 = "$1==$2";
}
This is actually the very first thing I want to do :)
There is a quite precise specification of all this in
the ISO C++ Standard. Because of the way C++ 'genericity'
works by syntactic form, such definitions are
already 'polymorphic'.
I am *already* doing this with interscript generators,
but of generating 'text' is not very nice :)
You may note: change the word 'typeclass' to 'module'
and the above actually works NOW.
The problem is, it is fully parametric.. it will happily
generate Iterator[float, double] which will then fail
at C++ compiler time .. instead of Felix compile time.
> > fun add: t * t -> t = "add($1,$2)";
>
> Sorry about that. I guess I had been working in Haskell and C too
> much and forgot I had to add the 'fun.' That default defined syntax
> is a bit of a surprise, though.
Yeah. I am inclined to change a few things, including:
= "add($1, ...
because that looks like a string .. when it is meant to be
a C expression with 'holes' in it. Of course .. the compiler
literally substitutes into the holes and then emits the
string .. so it actually IS a string too :)
> On the other hand, there may be
> a way to consider a typeclass block as a special context and parse it
> differently.
Yes, that's possible too.
> odd-looking. I don't suppose people are very much used to ascii-
> pictures in this Time Of Unicode.
Show me one person actually using Unicode to program :)
I mean, fix my damn Vim so it displays Unicode and I just
might. But in any case the symbol set in Unicode isn't
very good for programming ..
> > x \subseteq y
>
> That would be excellent for literate Felix :)
Felix can handle 'multiple ways of doing things'. I have a good
mind to actually use some subset of TeX, LaTeX and AmSTeX
symbol sets, with their official names. This doesn't mean
there can't be other ways. Generally
a + b
in Felix is actually
add(a,b)
and one is very tempted to rip off Haskell and allow
a `add` b
if only we weren't so short of punctuation :)
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language