funq: syntax that doesn't scare off C++ developers
Marco Martin
notmart at gmail.com
Fri Jul 25 09:15:06 UTC 2014
On Friday 25 July 2014, Aaron J. Seigo wrote:
> The other primary goal with the syntax is to keep it simple through
> clarity, consistency and trying to always provide "just one way to do
> things".
>
> So here is the basic anatomy of a funq function:
>
> tags functionName(parameter list) : preconditions
> {
> code block
> }
thinking about it, couldn't this syntax cause a bit of confusion and one may
ask: why i can't put my piece of imparative code as "code block" ?
is probably not evitable anyways and one would have to just get over it, just
throwing a quick gut feeling ;)
> Variables are single-assignment (you can't assign a different value to a
> variable once it is set) and typing is inferred (but not dynamic, due in
> part to single-assignment). Due to single-assignment, there is no need for
> a comparison operator (==). The assignment operator does both assignment
> and checking. So:
>
> x = 1; // x is now 1.. obvious :)
> x = 2; // false!
> 1 = x; // true!
> x = "An awesome string"; // false!
> y = x; // true! y now also equals 1
> z = 3;
> y = z; // false!
> y = x; // true!
again, wouldn't be something like
x = 1;
y = 3;
be interpreted as imperative?
second question on this
x = 1;
x = 1;
so the second line is actually a comparison and returns true.
do the first, that is an assignment "return" something?
like, would
fun()
{
x = 1;
}
have any meaning whatsoever?
--
Marco Martin
More information about the Funq-devel
mailing list