funq: syntax that doesn't scare off C++ developers

Aaron J. Seigo aseigo at kde.org
Fri Jul 25 10:36:59 UTC 2014


On Friday, July 25, 2014 11:15:06 Marco Martin wrote:
> 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 ;)

the biggest reason why not is because the control flow syntax is *extremely* 
limited. currently i'm only planning on offering if/else. no loops (while, for, 
..), no switch statements, ... so the opportunity for writing imperative style 
code is pretty limited.

> again, wouldn't be something like
> x = 1;
> y = 3;
> 
> be interpreted as imperative?

i'm not toooo worried about where the line is drawn. the point isn't to create 
the most rigid functional language, but something that is both usable and 
pushes .. er .. encourages developers into writing functional style code.

> second question on this
> 
> x = 1;
> x = 1;
> 
> so the second line is actually a comparison and returns true.

correct

> do the first, that is an assignment "return" something?

yes, the value

> like, would
> 
> fun()
> {
>    x = 1;
> }
> 
> have any meaning whatsoever?

sure; it would assign 1 to x and then return a value of 1. hopefully the 
compiler will be smart enough to not actually include the x variable in the 
resulting generated bytecode :)

i do see the ambiguity you are referring to, however (= during assignment, = 
during comparison) ... will work on that. 

-- 
Aaron J. Seigo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://kde.org/pipermail/funq-devel/attachments/20140725/61769134/attachment.sig>


More information about the Funq-devel mailing list