What about supporting both <> and != for inequality? Just go with != ?
To minimize confusion I would go with just a single operator for each operation. If an operator is different people will think the semantics are different as well. What real advantage do you get by having these synonyms?
One advantage to supporting the old operators is the ability to port Spin1 code to the P2 without a lot of changes. On the other hand, it is likely that almost all Spin1 programs will require some changes to run on the P2, so maybe it's not a big deal to convert the operators as well. Someone will just need to write a converter program to automate the process.
What about supporting both <> and != for inequality? Just go with != ?
If both symbols are used in other languages then it makes sense to support both. Either one seems clear enough to me.
By that logic Spin2 should also support {} and BEGIN / END for block structure in addition to indentation. I think each language makes its own choices about these syntax issues. It doesn't make sense to try to be all things to all people.
What about supporting both <> and != for inequality? Just go with != ?
If both symbols are used in other languages then it makes sense to support both. Either one seems clear enough to me.
By that logic Spin2 should also support {} and BEGIN / END for block structure in addition to indentation. I think each language makes its own choices about these syntax issues. It doesn't make sense to try to be all things to all people.
I was referring to this list of operators.
! NOT
&& AND
|| OR
^ XOR
<< SHL
% MOD
[b]=< <=
=> >=[/b]
<> !=
Based on the single character operators != is just as clear if not more so than <> as the not equal operator. The same is true of other logically consistent combinations. How is >= for greater than or equal any less valid or harder to understand than => equal to or greater than. Same is true of other combinations. That does not mean that a lot of illogical or poorly chosen symbols should be added just because they are used in other languages.
I thought the idea was to harmonize the operators in line with many other very popular languages, C, C++, C#, Java, Javascript and more. Thus minimizing confusion for the vast majority of people coming to Spin, who will most likely have experience in one of those common languages already.
To minimize confusion for those new to programming and starting with Spin there should only be one way to write each operator.
Those operators that are Spin specific, not found in other languages, should have function or keyword syntax. Not cryptic symbols.
What about supporting both <> and != for inequality? Just go with != ?
If both symbols are used in other languages then it makes sense to support both. Either one seems clear enough to me.
By that logic Spin2 should also support {} and BEGIN / END for block structure in addition to indentation. I think each language makes its own choices about these syntax issues. It doesn't make sense to try to be all things to all people.
I was referring to this list of operators.
! NOT
&& AND
|| OR
^ XOR
<< SHL
% MOD
[b]=< <=
=> >=[/b]
<> !=
Based on the single character operators != is just as clear if not more so than <> as the not equal operator. The same is true of other logically consistent combinations. How is >= for greater than or equal any less valid or harder to understand than => equal to or greater than. Same is true of other combinations. That does not mean that a lot of illogical or poorly chosen symbols should be added just because they are used in other languages.
They are all easy enough to understand. However, having only a single operator per operation will make it easier for one person to read another's code and also make it easier for people coming from languages with similar operators.
How do you say "=>" in English? Do you really say "equal to or greater than"? I've always said "greater than or equal to".
What about supporting both <> and != for inequality? Just go with != ?
If both symbols are used in other languages then it makes sense to support both. Either one seems clear enough to me.
By that logic Spin2 should also support {} and BEGIN / END for block structure in addition to indentation. I think each language makes its own choices about these syntax issues. It doesn't make sense to try to be all things to all people.
Yes!!! Please add a mode switch so that we can use {} and also use ; at the end of the line so we can pack more multiple statements per line.
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
Since you're already drinking the Kool-Aid I guess you could go to 0bXXXX for binary and 0xXXXX for hex. :-)
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
Since you're already drinking the Kool-Aid I guess you could go to 0bXXXX for binary and 0xXXXX for hex. :-)
That's just too ugly. I hate seeing hex and binary numbers all cluttered up with that awful syntax.
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
Since you're already drinking the Kool-Aid I guess you could go to 0bXXXX for binary and 0xXXXX for hex. :-)
That's just too ugly. I hate seeing hex and binary numbers all cluttered up with that awful syntax.
Yeah, it is kind of ugly. I didn't really expect you to go for it. Given that, either of the syntaxes you proposed should be okay.
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
Since you're already drinking the Kool-Aid I guess you could go to 0bXXXX for binary and 0xXXXX for hex. :-)
That's just too ugly. I hate seeing hex and binary numbers all cluttered up with that awful syntax.
Yeah, it is kind of ugly. I didn't really expect you to go for it. Given that, either of the syntaxes you proposed should be okay.
Thanks. That's quite an admission about C you made there, Dave.
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
Since you're already drinking the Kool-Aid I guess you could go to 0bXXXX for binary and 0xXXXX for hex. :-)
That's just too ugly. I hate seeing hex and binary numbers all cluttered up with that awful syntax.
Yeah, it is kind of ugly. I didn't really expect you to go for it. Given that, either of the syntaxes you proposed should be okay.
Thanks. That's quite an admission about C you made there, Dave.
I never claimed that C was the perfect language. I use it mainly because I can write code and if I'm careful it ports reasonably easily to other platforms. Also, much of the open source code on the web is written in C or C++.
What about supporting both <> and != for inequality? Just go with != ?
Is there a conflict here ?
Why not support both ?
A Math teacher will understand <>, whilst a C programmer will understand != (aka not equal)
Which is your main audience here, people already immersed and skilled in C ? or those in Education, and a broader audience ?
What about supporting both <> and != for inequality? Just go with != ?
To minimize confusion I would go with just a single operator for each operation. If an operator is different people will think the semantics are different as well. What real advantage do you get by having these synonyms?
The advantage is ease of understanding to those not skilled in C.
I can understand that someone who is skilled in C, sees any other language as clutter, but I believe Parallax have a much wider audience here.
Some care is needed to not morph Spin into a straight jacket of almost-C, and along the way lose the readability gains that Chip has made on these revised operators.
What about supporting both <> and != for inequality? Just go with != ?
Is there a conflict here ?
Why not support both ?
A Math teacher will understand <>, whilst a C programmer will understand != (aka not equal)
Which is your main audience here, people already immersed and skilled in C ? or those in Education, and a broader audience ?
A math teach will not use either. He/she will use an equal sign with a slash through it.
Potatohead pointed out a conflict with % and binary number declarations. I don't want to loose %0101_1111, so % cannot be modulus. What about using // or MOD for modulus?
// is already widely used, in many languages, as a comment to end of line.
I'm not sure % is entirely lost ? - as 12 MOD 4 or 12 % 4 is understood by the parser.
ie the white space makes it quite clear what use % has ?
What about supporting both <> and != for inequality? Just go with != ?
To minimize confusion I would go with just a single operator for each operation. If an operator is different people will think the semantics are different as well. What real advantage do you get by having these synonyms?
The advantage is ease of understanding to those not skilled in C.
I can understand that someone who is skilled in C, sees any other language as clutter, but I believe Parallax have a much wider audience here.
Some care is needed to not morph Spin into a straight jacket of almost-C, and along the way lose the readability gains that Chip has made on these revised operators.
I would rather see Spin2 use just => and =< than use both the C-style operators and the old Spin-style operators.
Comments
Done.
If both symbols are used in other languages then it makes sense to support both. Either one seems clear enough to me.
I was referring to this list of operators. Based on the single character operators != is just as clear if not more so than <> as the not equal operator. The same is true of other logically consistent combinations. How is >= for greater than or equal any less valid or harder to understand than => equal to or greater than. Same is true of other combinations. That does not mean that a lot of illogical or poorly chosen symbols should be added just because they are used in other languages.
To minimize confusion for those new to programming and starting with Spin there should only be one way to write each operator.
Those operators that are Spin specific, not found in other languages, should have function or keyword syntax. Not cryptic symbols.
How do you say "=>" in English? Do you really say "equal to or greater than"? I've always said "greater than or equal to".
Yes!!! Please add a mode switch so that we can use {} and also use ; at the end of the line so we can pack more multiple statements per line.
That's just too ugly. I hate seeing hex and binary numbers all cluttered up with that awful syntax.
Thanks. That's quite an admission about C you made there, Dave.
Okay. Thanks.
What bugs me is the use of "=" as an assignment.
In mathematics, where "=" comes from, x = y is does not mean set x to the value of y. It is a statement of fact that x is actually the same as y.
Which is why other languages use ":=" or such for assignment.
But that is even more ugly.
Why not support both ?
A Math teacher will understand <>, whilst a C programmer will understand != (aka not equal)
Which is your main audience here, people already immersed and skilled in C ? or those in Education, and a broader audience ?
I can understand that someone who is skilled in C, sees any other language as clutter, but I believe Parallax have a much wider audience here.
Some care is needed to not morph Spin into a straight jacket of almost-C, and along the way lose the readability gains that Chip has made on these revised operators.
// is already widely used, in many languages, as a comment to end of line.
I'm not sure % is entirely lost ? - as 12 MOD 4 or 12 % 4 is understood by the parser.
ie the white space makes it quite clear what use % has ?