Spin Syntax/Semantics
heater
Posts: 3,370
Anyone got any idea about the following constructs in a CON block ?
None of those names exists any place else in the code at the time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Post Edited (heater) : 6/3/2008 7:08:10 PM GMT
CON a_name = 2, b_name, c_name, d_name 'Etc etc e_name, f_name, g_name = 2, h_name, i_name 'Etc etc j_name, k_name, l_name
None of those names exists any place else in the code at the time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Post Edited (heater) : 6/3/2008 7:08:10 PM GMT
Comments
One can type those statements into a CON section and it compiles without complaint.
So the question is what do they actually mean/do ?
How can I put the subject that I forgot onto this thread ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Page 194
Next question (and yes I am looking in the FM without success so far) are the comparisons < > etc signed or unsigned ?
Guess I could start experimenting as you suggest but it would be nice to see it specified some where.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
const double x = 1.0, y = 2.0, z = 3.0;
·
I don't mean to be picky but just this once
I did say "succinct" and "enumerations". Your example is not an enumeration but a series of constant definitions.
Below are a few examples of enumerations in various languages:
Now I think you'll agree that SPIN takes the cake here with the total absence of keywords, brackets, commas, semicolons or indeed any printable syntactic elements at all !
Imagine you wanted to write a compiler wouldn't you rather just allocate an increasing number to a list of names or parse all that other junk a well?
Of course the other languages have reasons for what they do especially when defining enumeration types.
Cheers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Spin solves an age old mathematical mystery, what is the square root of minus one ?
CON
i = ^^ -1
Answer seems to be $0000FFFF.
But then i squared should be 1
CON
i = ^^ -1 * ^^ -1
Gives $FFFE0001
Oh well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Is the use of array indexing a constant documented anywhere ?
Seems a very strange idea.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Here's another one anyway, the strangest form of string concatenation ever:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Just remember: commas butt the ends of strings together; plus signs tie them in a knot.
-Phil