The code generated by both forms should be identical, and it is proposed as a sytnax-alternative of the same decision, so I'm not follow the "much more efficient" claim ?
Personally I think ternary operators should be be removed altogether. From all programming languages everywhere.
As jmg says the code generated by a human readable "if ... then ...else..." should be the same.
Ternary operators are just a twist in the syntax, an extra complexity, that is not really needed.
Yeah I know, it's less characters to type in the source. So what? The time saved in typing is passed on as extra time for the reader to figure out what is going on.
Chip,
I really like the ternary ? operator as you show here. It's really concise and easy to read. Please stick with it.
Heater,
We all know you hate it, please stand down. It's not going away. As I said above, I think x := e ? a : b is what easier to read/parse, maybe because I've been using it for the better part of 4 decades?
jmg,
Sure the spin compile result should be the same, but the compiler code to parse it and handle it will be more work, for sure. Probably not a super lot, but more. It also becomes more cumbersome with nesting.
jmg,
Sure the spin compile result should be the same, but the compiler code to parse it and handle it will be more work, for sure. Probably not a super lot, but more. It also becomes more cumbersome with nesting.
I agree, not a super lot, but remember this was in the context of suggestions the parser infer which ? applies, from context, which sounds like even more work to me.. ? can mean many things....
Catching an if following an assignment operator, is rather less context work.
jmg,
I hope Chip leaves it so that ? for ternary, and ?? is the random. makes it much more clear at a glance and easier to parse.
Phil always wants more "inferring" things from context Smile. He should write his own compiler and see how hard that is to actually do in the real world.
Chip,
I really like the ternary ? operator as you show here. It's really concise and easy to read. Please stick with it.
Heater,
We all know you hate it, please stand down. It's not going away. As I said above, I think x := e ? a : b is what easier to read/parse, maybe because I've been using it for the better part of 4 decades?
jmg,
Sure the spin compile result should be the same, but the compiler code to parse it and handle it will be more work, for sure. Probably not a super lot, but more. It also becomes more cumbersome with nesting.
I do too. The concise, and permissive nature of SPIN is what I appreciate most.
Guys, SPIN has a character, ways of working that present a strong set of tradeoffs.
I know it looks like a cleanup opportunity to some of you. Understandable, but please also understand it's breaking something valuable, flexible, efficient and potent to people who use it a lot.
Had SPIN+PASM been what is often suggested, I would have never looked at a P1. Lots of us out there who want it that way for P2.
Needs to exist.
Once Chip does it the way he does it, which does impact the language in ways those of us want it for P2 really get benefit from, Roy will do OpenSpin.
At that point?
Show us your best! Who knows? Could be golden.
And, C will get done too.
At that point, game on!
There is no need to bend SPIN away from it's roots now. Lots of us want it to exist.
Heater,
It's interesting because I rarely try to save characters. I use long variable, function , and class names. I include extra white space (space between things and blank lines between chunks).
I just find the ternary ? setup easy to read at a glance, and especially so for more complex constructs where the equivalent if/else//etc. setup just gets silly.
Comments
I agree.
-Phil
The code generated by both forms should be identical, and it is proposed as a sytnax-alternative of the same decision, so I'm not follow the "much more efficient" claim ?
As jmg says the code generated by a human readable "if ... then ...else..." should be the same.
Ternary operators are just a twist in the syntax, an extra complexity, that is not really needed.
Yeah I know, it's less characters to type in the source. So what? The time saved in typing is passed on as extra time for the reader to figure out what is going on.
I really like the ternary ? operator as you show here. It's really concise and easy to read. Please stick with it.
Heater,
We all know you hate it, please stand down. It's not going away. As I said above, I think x := e ? a : b is what easier to read/parse, maybe because I've been using it for the better part of 4 decades?
jmg,
Sure the spin compile result should be the same, but the compiler code to parse it and handle it will be more work, for sure. Probably not a super lot, but more. It also becomes more cumbersome with nesting.
I agree, not a super lot, but remember this was in the context of suggestions the parser infer which ? applies, from context, which sounds like even more work to me.. ? can mean many things....
Catching an if following an assignment operator, is rather less context work.
I hope Chip leaves it so that ? for ternary, and ?? is the random. makes it much more clear at a glance and easier to parse.
Phil always wants more "inferring" things from context Smile. He should write his own compiler and see how hard that is to actually do in the real world.
I do too. The concise, and permissive nature of SPIN is what I appreciate most.
Guys, SPIN has a character, ways of working that present a strong set of tradeoffs.
I know it looks like a cleanup opportunity to some of you. Understandable, but please also understand it's breaking something valuable, flexible, efficient and potent to people who use it a lot.
Had SPIN+PASM been what is often suggested, I would have never looked at a P1. Lots of us out there who want it that way for P2.
Needs to exist.
Once Chip does it the way he does it, which does impact the language in ways those of us want it for P2 really get benefit from, Roy will do OpenSpin.
At that point?
Show us your best! Who knows? Could be golden.
And, C will get done too.
At that point, game on!
There is no need to bend SPIN away from it's roots now. Lots of us want it to exist.
That is how I want it to be, too.
I can match your four decades. Such things still cause my mind to stall when reading them.
Experience tells me that good programmers love to save a few characters of typing with their obscure hieroglyphs. At the expense of legibility.
Ah well.
It's interesting because I rarely try to save characters. I use long variable, function , and class names. I include extra white space (space between things and blank lines between chunks).
I just find the ternary ? setup easy to read at a glance, and especially so for more complex constructs where the equivalent if/else//etc. setup just gets silly.