How would you describe Spin as a language?
Peter Jakacki
Posts: 10,193
Hi guys (n gals),
I was just writing up a new datasheet and I decided to expand on the short description I normally give to the Propeller and in particular the way it is programmed. In a C centric world saying that the Propeller is programmed in Spin is not very helpful. I could say it is Pascal-like maybe? But they may draw the wrong conclusions (them, not me). To me a language is a language, all of them have pro's and con's but how would you describe Spin as language and do so succinctly and positively?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
I was just writing up a new datasheet and I decided to expand on the short description I normally give to the Propeller and in particular the way it is programmed. In a C centric world saying that the Propeller is programmed in Spin is not very helpful. I could say it is Pascal-like maybe? But they may draw the wrong conclusions (them, not me). To me a language is a language, all of them have pro's and con's but how would you describe Spin as language and do so succinctly and positively?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Example, please? I'm not seeing it.
I don't know about this. The Spin "virtual machine" is stack-based, but it takes more than that to be Forth-like (in particular, I believe most Forth people would say a defining characteristic of Forth is its separate data and return stacks).
Now, how about a description....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--RvnPhnx
to professional programmers a description that makes them feel challenged what I should not be able to learn it ?
to newbees a description that gives confidence:
you will learn it almost as quick as basic but if you have learned you are fare above
of what basic-programmers can do. And you are well prepared for other languages
Or to say ot similar like localroger quote "It truly is a synthesis of the strengths (in a very particular manner of evaluation) of many different approaches."
It takes the best from the most popular programming languages and combines them to suit very well to the hardware of the propeller.
As the propeller is a multi-core-microcontroller, start by using a single core. Use a second core as easy as starting a second program on your PC for backround-drivers
to replace easily interrupt-programming.
By the time add more an more cores as you drive up the learning-curve leaving other microcontrollers behind.
Where others are fiddling around to speed up IRQ-subroutines stay relaxed by just starting another core.
In my eyes Chip did a really great job. The architecture, SPIN-syntax, the propeller-IDE everything well developed to work effectivly
best regards
Stefan
Post Edited (StefanL38) : 10/30/2009 10:29:18 PM GMT
* Weird operators that redefined standards set by other languages.
* Bended and blended different meanings into one scope (byte, word, long; whenever I read that, I slam my head; word should be 32 bits on on 32 bit processor).
* Took buzzwords from other languages to make it shine ("objects", but it's not OO).
* Completely untyped and thus not suited for education
* Lacks concepts for save coding
* Designed by someone with no background in language-design
Sorry, had to write that, but its true. And I'm tired of the repeated hurras about SPIN. SPIN is Smile, but it works and its a compact language. And only worth learning because it comes along with the processor.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
* Weird operators that redefined standards set by other languages.
* Bended and blended different meanings into one scope (byte, word, long; whenever I read that, I slam my head; word should be 32 bits on on 32 bit processor).
* Took buzzwords from other languages to make it shine ("objects", but it's not OO).
* Completely untyped and thus not suited for education
* Lacks concepts for save coding
* Designed by someone with no background in language-design
Sorry, had to write that, but its true. And I'm tired of the repeated hurras about SPIN. SPIN is Smile, but it works and its a compact language. And only worth learning because it comes along with the processor.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
I would describe SPIN as lean, useful, easy to learn, and well matched to the processor hardware attributes. There is nothing else like SPIN + PASM.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
With a couple of exceptions (most notably the very efficient but hatedly obscure ~ and ~~ operators) everything in Spin is found somewhere else.· They aren't all found in one language, but are a distillation of what works best and (particularly) is most memory efficient in all of them.· This is not an unreasonable design goal on a platform that is deliberately memory-limited.
This is as stupid as the Comp Sci teacher I had back in 1981 who insited "byte" meant "any subdivision of a word" instead of "8 bits."· He was wrong then, time having marched on,·and you are wrong now.· On embedded platforms in particular a word is 16 bits just as a byte is 8.· "Long" is a reasonable extension to assert 32.· As for using the word length of the machine in any meaningful way, that's been dead since IBM advertised the 8088-based IBM PC as a "16-bit" processor back in 1982.
Only because it doesn't do YOUR VERSION of OO.· In 1970 it would have been considered quite radically OO.· (No GOTO?· No, really, you mean no GOTO at ALL?· And if I need to send some data to the video, and it's in southland object, and I just well you mean I really can't just send it the data from northpark object?· AT ALL?· I mean they're in the SAME MEMORY SPACE man, DO YOU REALIZE HOW CRAZY THAT IS?· /1979 self)
If by "education" you mean "educating people how to write modern high-level code" then maybe yah.· But if you mean "educating people how the damn computer works and therefore how to write better code in their modern high-level environments" then you fail it.
I suppose it is an example of my philistinism that I can't even figure out what you are talking about here.· Unless you mistyped "safe" in which case I'd say the first tool in writing safe code is learning the hard way to write safe code in an unsafe environment.· After a few crashes and three day debug fests to find the missing ~ you learn not to depend on the tools, which don't always work.· The tools are great when they do work but when they don't work if you can't do it the old-fashioned way you are teh screwz0r3d, and the Prop is meant to teach you to do it the old-fashioned way.
And by the same criterion I insist to this day Grandma Moses can't possibly be an artist, because nobody ever taught her how to paint right.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum
At least "word" is defined by the language as 16 bits which I hope does not change. It is a trap we already fell into once with "int" and hope we don't get a repeat.
Actually method signatures are typed as "long" whether one likes it or not. Of course there is no warning if one accidentally abuses that.
Post Edited (jazzed) : 10/31/2009 2:14:03 AM GMT
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
byte, word, long
Hey, Nick, how does your head feel now?
-Phil
I initially found a few of the assign operators peculiar, but when you look into the interpreter source and you see how the compiler builds assignments like that I suspect it was almost easier to let all operators that could be assignments be so rather than special case them so they don't. If you get my drift.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If you always do what you always did, you always get what you always got.lt's not particularly silly, is it?
One thing I really like about Spin is the way it handles Boolean operations. The usual way of using bitwise operators for Boolean is elegant but when you start using source values other than 0 and -1 it can get tricky. Having the distinct Boolean operators that coerce all nonzero values to -1 is very handy, very readable, and especially useful when you're mixing data types like mad to save RAM and your byte -1 looks like 255 compared to your word -1.
My litle addition on naming BYTE, WORD, LONG it is most logical.
BUT some assembly languges name it BYTE, WORD, DUBLE Word, and at last 64 bits ... Quad Word.
In my opinion no mather what name is ... Only it that name is understandable.
All "weired" operators that some CALL it ... WHT it is so much discusion on that .... It is not to hard to learn!!!!
What about describing SPIN ...... It is just SPIN Language not mather if it are Like other -- Diference Give it its new possiblites that are needed for Propeller to function.
Istead of time to discus that .... Give it TIME to Learn IT. Then it will be Yours next language.
Ragards
ChJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.
Sapieha
Sure, relatively easy to learn ... *BUT* no easier than many other idiosyncratic dead programming languages.
Very few people coming to this hobby come into it from a vacuum; most everyone here has had some programming
experience and SPIN being so different from everything leverages very little of that experience.
Fundamentally SPIN exists because Chip found it easier/more enjoyable to create a new language than to
understand and do the work to adopt an existing language to the propeller. And I wouldn't discount the
economic point for Parallax to have a captive audience by having a proprietary language.
If SPIN was such a wonderful thing, how come that nobody outside this Propeller community uses or is even aware of SPIN?
How come SPIN has not been adopted by anybody else?
And if SPIN is so wonderful, how come there are so many development efforts here to create alternative compilers/languages?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
Jo
Spin is totally unsuited to teaching beginners programming or learning about micro-controllers for that matter.
Its saving grace is that Parallax included a bunch of useful objects when it was released and that it came free with the Prop.
I just hope the PropII isn't tied to Spin like the current version is.
I hope that Spin (perhaps with a few tweaks and extensions) persists with the Prop II. Despite being difficult to categorize, it's the right tool for the Propeller.
-Phil
That's exactly the point I meant with patchwork!
I'm not complaining of the ritch set of operators, but the fact that they are taken from languages that are quite orthogonal. A much clearer solution to add those extra ops would have been:
Take a route that is known (like Pascal, or C) for the common operators and add the extra ones by function-lookalikes. That wouldn't have added more code.
> This is as stupid as the Comp Sci teacher I had back in 1981 who insited "byte" meant "any subdivision of a word" instead
> of "8 bits."
Fortunately, I didn't say that! And even didn't want to say it.
> On embedded platforms in particular a word is 16 bits just as a byte is 8.
On 16 bit processors? So, I'm right.
> As for using the word length of the machine in any meaningful way, that's been dead since IBM advertised the 8088-based IBM
> PC as a "16-bit" processor back in 1982.
So they were the first one to make that nonsense? Websters dictionary: Word ... and which functions as the smallest meaningful unit of a language.
> Only because it doesn't do YOUR VERSION of OO. In 1970 it would have been considered quite radically OO.
What date do we have now? "Object" has a quite well defined meaning in any programming-language taht is OO. And Parallax's use is an abuse of it.
> But if you mean "educating people how the damn computer works and therefore how to write better code in their modern
> high-level environments" then you fail it.
So there is no need at all for a high(er) level language. Bite the PASM thing or die!
> Unless you mistyped "safe"
I did that. It's hard for Germans to distinguish safe and save.
... the first tool in writing safe code is learning the hard way to write safe code in an unsafe environment.
Well PASM. See above. No need for SPIN.
> And by the same criterion I insist to this day Grandma Moses can't possibly be an artist,
> because nobody ever taught her how to paint right.
OK, so it is naive art! LOL!
My point is not, that SPIN is different. My point is, that it is different in needless places.
There are derivates of languages like Tiny Pascal, or Tiny C or whatever you want. They do work, they do have shortcuts and additions are welcome to.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Not sure I see the programming model connection here. Apart from a superficially similar concept of data being divided into "shared" and "private" areas. A cursory glance at that document shows me that OpenMP is more to do with enabling the programmer to have parts of his algorithm parallelized. For example being able to write a loop construct which iterates over an array in such a way that the array can be divided into chunks each to be handled by a different CPU. More processors automatically getting you faster processing of the array with no recoding.
Spin comes nowhere near those ideas.
Now if RossH could get OpenMP working with his C compiler....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
The idea that it may be a dud because it was designed by a non language design guru does not wash. ADA, as one example, was designed by a whole tribe of language gurus, see how popular that turned out. On the other hand when C was bashed out by Dennis Ritchie I'm not sure he was in the language guru class.
How can Spin not be a great introductory language for teaching programming or micros? It has the least amount of cruft required to understand in order to get from knowing nothing to getting a LED to flash whilst being quite capable of complex tasks as one learns. A role that BASIC was used for and Logo was designed for.
As for Spin adoption vs age/experience. What's the problem? I've programmed in a lot of languages over the years, all the way back to Algol. Spin is just another one, with it's own quirks. Seems to fit the task at hand very well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
What I really like about Spin is that you can use it to teach microcontroller programming on different abstraction levels. I have students who will never progress past simple
calls (using objects that others wrote), but I also have students who can write bit-banging drivers and flirt with the assembler. So Spin is suitable both for those who want to work on the high level (say write the code for in-flight trajectory prediction) and those who are more intrigued by getting a particular piece of silicon work (say writing the driver for ADC or flash memory chip).
Obviously the major problem of Spin is its very limited speed but conceptually it's a sound language well fitted to the size and capabilities of the host platform (those of you calling for full OO capabilities please consider the cost especially executable code size wise) .