funq: syntax that doesn't scare off C++ developers
Ivan Čukić
ivan.cukic at kde.org
Fri Jul 25 12:36:09 UTC 2014
> someFunction(a, b, c) when (a > 0)
Something like that could make sense. As I said in the previous mail, I'm
trying to come up with a sintax that can be terse and expressive.
> > less bugs can get into the code
>
> true, and i keep going back and forth on this one in my head. i want to keep
> the syntax "terse" and consistent and requiring return types to be defined
> or making them optional works against one or the other.
>
> there are many times when having multiple return types is very useful, of
> course. if nothing else, it allows error objects to be treated as a normal
> return value rather than an exceptional state like an exception.
You are right, though I'd rather have explicitly stated return types and
errors - like Either(Real, ParsingError)
> 'type type' (e.g. `a) but that is one more concept for the developer to
> learn and keep straight.
Yes... type classes would be an overkill for the beginning :)
> func() { a = 2; }
I'd propose then a keyword equivalent to 'auto' in C++, or 'let', or 'val' or
whatever for definitions. (again, it would make parsing *much* easier - no
ambiguities)
The problem would be is it
(val x, y) = somePair // matches on y, extracts x
val (x, y) = somePair // extracts both x and y
(val x, val y) = somePair // extracts both x and y
(x, y) = somePair // matches both
Cheerio,
Ivan
KDE, ivan.cukic at kde.org, http://ivan.fomentgroup.org/
gpg key id: 850B6F76, keyserver.pgp.com
More information about the Funq-devel
mailing list