4 ms·
Haxe uses the first syntax, as does AS3. So it's not like "other languages" are universally opposed to this order.
by Drakim 12y ago
Haxe uses the first syntax, as does AS3. So it's not like "other languages" are universally opposed to this order.
- allan_s 12y agoRust also has this syntax if I remember correctly, for parsing reason
- tne 12y agoAFAICT both Haxe and AS3 consistently put types on the right, including argument declarations. Other languages consistently put it on the left. Most languages make a choice like that; PHP mixes things up a bit. But then, it wouldn't be PHP if it was too consistent ;).
- TazeTSchnitzel 12y agoTo be fair, it's not the same as an argument type. The type of `foo()` isn't int, it's function. You're not specifying the type of the thing itself, merely the type of what it returns. Though this seems to have been lost on the creators of C. ;)
- pilsetnieks 12y agoGo also has a similar syntax (except the colon)
- aikah 12y agosure but AS3, Go Haxe and others ARE consistant function foo(a:int,b:string):bool{} in PHP this will be function foo(int a,string b):bool{}
- notacoward 12y agoPutting the type first for parameters and last for return values seems like exactly the same kind of inconsistency that has already earned PHP plenty of criticism. Personally I kind of like the Pascal style, I use the C style all day every day, but mixed style seems like the worst option available.