Shop OBEX P1 Docs P2 Docs Learn Events
How would you describe Spin as a language? - Page 4 — Parallax Forums

How would you describe Spin as a language?

1246789

Comments

  • cgraceycgracey Posts: 14,256
    edited 2009-11-03 15:09
    Some have rightly pointed out that Spin is it not a "true" objected-oriented language. No argument here. We went with the term "object" only because we figured it would make the most sense to people. There was no intention to misrepresent what Spin actually is. In retrospect, I wish we had gone with calling files "modules", and citing Spin as a "modular" language. It would have been more accurate, MUCH CLEANER, and mentally unencumbering for experienced programmers, as we now fight, as Potatohead calls it, "hysteresis".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.

    Post Edited (Chip Gracey (Parallax)) : 11/3/2009 3:20:33 PM GMT
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-11-03 15:22
    > Having formal education in computer language design is handy because you may be exposed to tools and ideas that you
    > might not have otherwise, but it's not necessary to produce good work.

    Well "formal" by having a degree in computer linguistics, then no. But there are many books and languages to look at to get an deeper understanding. My favorite book about that is "Literate programming" by D. Knuth. It's not the bible, but it has interesting concepts worth understanding and adopting. Or a language like Eiffel. Well, quite complicated, but from a concept's point of view very interesting. But nothing for the Prop. wink.gif

    Certainly, you can produce good work in (almost) any (?) language. The point is, that some languages make it easy to make errors (I add C here) but also, they do provide the *tools* to safe typing/design. SPIN is a language that makes errors easy and also has no tools/provisions to play the safe way.
    If SPIN was intended to be a language to get a LED blinking in a short time, its a success. For education about programming or -even "worse"- software-engineering, or complex projects, it's a failure. Its an introductionary language like the old BASIC was (not new BASIC-dialects!).
    But still, you *can* do complex projects if you accept the PITA. Not my route to take when I see better things around.
    You can even write good programs in ASM, no doubt. If you can only justify the amount of time spent/wasted.

    As soon as the Prop II is out, you'll realize that SPIN is beyond its limits.

    > Remember that many of the designers and implementers of the foundational ideas and tools in this area had no formal training
    > in it because they created it in the first place.

    Then I'm qualified too! wink.gif I studied automotive engineering, only to discover that programming was the thing I liked the most. There was a lot to learn and I paid thousands for books. And had (and wanted) to spend a lot of time investigating into concepts and languages. One of the languages most interesting and worth all the efforts was NewtonScript. My home-page for that one is long gone (www.logic-tools.de).

    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-11-03 15:31
    > @Sam and Nick - Come on lads leave it out ! - this is not what the forum is about.

    I only cite what Sam directed at me:
    "How about we cart you off to the LOONY BIN and shut you up in a room for the rest of your life you pitiful CRAZY FOOL".

    The rest of his answers were no arguments. And argumenting back on his non-arguments only resulted in NO answer, but new bendings. Just look at the "#include" argument how he distorted things systematically. If he's too stupid to understand that "object" in SPIN is just a synonym for "#include" of the implementation-file in C, I can only say "Better shut up and step back".

    I'm really Smile*ed of people like these!


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • potatoheadpotatohead Posts: 10,261
    edited 2009-11-03 15:54
    ...as we now fight, as Potatohead calls it "hysteresis".

    To be clear, I was thinking of the heat formed in response to a change in state, and the resistance that comes with that, like in a transformer. I do think the Propeller use case dynamic is like that. It all depends on your pre Propeller exposure state, and the distance from that to how the propeller works, and the return for working the way the propeller does. This is not a fight, just an artifact of how people work. More like a balance, if that makes any sense. It's not to be avoided, simply leveraged and marginalized where possible for best overall return.

    Having the easy stuff be really easy, yet not keeping harder stuff of the table is one solid balance, and something I appreciate. The way I see it is people don't get to harder stuff, unless they reach some mastery of the easy stuff. From there then, it's a matter of preference and choices. This is much better than it being a matter of possible.

    Internally, I consider SPIN procedural. When I think that way, the SPIN PUB and PRI make great sense, and I have few troubles. Probably not accurate, but it works for me. All I know is I can rather easily read what others have done, but for all those difficult to remember short hand expressions, and combine it with something I did and have it work proper, quickly. This is extremely worth any other trade offs.

    Baggers comments generally seconded, but for the fact that I have not been programming for 25 years, and am currently enjoying the steady catch up journey. I learn much more quickly, from those of you showing more complex things, in this environment than I have any other. Was going to say that's great for beginners, or hobby users, but it's generally a good thing for everyone, right?

    One thing I found interesting as I've progressed along is that it's often possible to just build a lot into one SPIN file, and I absolutely love the self-documenting nature of it. I've seen people pack in schematics, HTML for visual / color references, and lots of other stuff. I really like this a lot. Another thing was the forced indentation. For me, this seemed odd, but now it's very readable, and I think I'm probably gonna continue to be a fan. I tend to hose up things that have to match (and adding the parenthesis highlight is a god send, thank you), so not having those things is generally a good thing where I come from.

    In the spirit of this thread, I think a SPIN obsfucation contest is in order. We can sort of celebrate this short hand notation property, exploit the comment features in twisted ways, and probably learn some great tricks, along the way. Double points for extreme brevity in text character count / program function. Ironically, making SPIN not all that readable will actually be a challenge. Isn't that neat? I think so.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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!

    Post Edited (potatohead) : 11/3/2009 4:00:51 PM GMT
  • JoJo Posts: 55
    edited 2009-11-03 16:07
    Not sure the argument here is going to be productive, as it appears we're all discussing past each other rather than
    with each other.

    The positions seem to be:
    a) I can do what I want with SPIN, so it is a good language. This is a legitimate pragmatic view point
    b) Important concepts in other languages are missing in SPIN so that makes SPIN not so great
    c) SPIN is OK, but it has some idiosyncrasies that make it annoying (constantly needing to refer to cheat sheet for what operators do)

    The issue with these positions is that they can all be right at the same time. Progress is only made when we can acknowledge validity
    in each others comments and work together to make things go forward.

    In any case, whatever its downsides, SPIN is functional enough to allow anybody to quickly get going and get stuff done on the Propeller.
    It could be better, it could leverage more experience from others. And I hope that some of this happens, that SPIN continues to evolve and
    grow along with its community. Already with BST a number of features important to me (such as conditional compilation) are available.

    And to address the "ease of use": with the right environment even C/C++ can be made fairly easy to use.
    Just look at the arduino environment. Here is the blink LED code:

    void setup() {
      pinMode(13, OUTPUT);      // make pin 13 an output
    }
    
    void loop() {
        digitalWrite(13, HIGH);   // output high
        delay(1000);                  // wait 1 second
        digitalWrite(13, LOW);    // output low
        delay(1000);                  // wait 1 second
    }
    
    



    The difference with arduino is that, should you need it, the full "at large" power of the C++ language is available for a developer to use.
    This is the kind of direction I wish could be taken with the next generation of SPIN.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    Jo
  • KyeKye Posts: 2,200
    edited 2009-11-03 16:24
    This tread is starting to degrade with the usual stuff. Better to lock it down now.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • Dave HeinDave Hein Posts: 6,347
    edited 2009-11-03 19:39
    Sam,

    This program works for me.· The compiler generates warnings, but it compiles and links OK.· I ran it on a Linux machiine.· You didn't say it had to run on a Propeller.

    Dave

    void main(void)
    {
    ··· int year;
    ··· char name[noparse][[/noparse]100];
    ··· printf("Enter name: ");
    ··· scanf("%s", name);
    ··· printf("Enter year of birth: ");
    ··· scanf("%d", &year);
    ··· printf("Hello %s you are %d years old\n", name, 2009 - year);
    }
  • jazzedjazzed Posts: 11,803
    edited 2009-11-03 20:15
    Someone needs a 34 point bold font eraser lol.gif
  • Dave HeinDave Hein Posts: 6,347
    edited 2009-11-03 20:27
    This C program would flash an LED just like the Spin program would.· I even formatted it to look like Spin.· All the #define's could be collected into a header file so the average programmer wouldn't need to see all the gory details.· That's the power of using the #include directive in C.

    Dave

    #define Pub······· extern
    #define repeatn(x) {int i; for (i = 0; i < x; i++);}
    #define repeat···· while(1){
    #define OUTA (*(long *)0x1f4)
    #define DIRA (*(long *)0x1f6)
    #define dira(x, y) DIRA = (DIRA & (~(1 << x))) | (y << x);
    #define outa(x, y) OUTA = (OUTA & (~(1 << x))) | (y << x);

    Pub main(void) {··· //make a LED flash
    · dira(23, 1)······ //make pin 23 output (has resistor and LED attached)
    · repeat
    ··· outa(23, 1)···· //pin 23 = 1
    ··· repeatn(1000)·· //delay
    ··· outa(23, 0)···· //pin 23 = 0
    ··· repeatn(1000)}} //delay
  • RossHRossH Posts: 5,516
    edited 2009-11-03 20:40
    Hi Dave,

    I thought using library functions was outside the scope of Sam's challenge, since most C compilers would throw warnings about functions with implicit prototypes - but on re-reading I see he just wanted to avoid #include. So your programs are good examples.

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-11-03 20:56
    > but on re-reading I see he just wanted to avoid #include.

    No, initially, it was "No header-files". Later on, he changed it to "no #includes at all". But that extension so braindead, that it even excludes SPIN.

    ...

    I already see a posting in 48 points comming up and saying "SPIN has no #includes !!!!!!!". My answer will be: "So delete the files which the objects you use reference to and you will see wether SPIN includes files or not.".

    Edit:
    BTW, that might be a trick to have includes in SPIN!


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • dandreaedandreae Posts: 1,375
    edited 2009-11-03 20:56
    Hey guys,·

    I realize everybody has an opinion here, however, let's try and keep it in a positive productive tone.· We're all here to learn·and share information to help one another.

    Thank you,

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support

    Post Edited (Dave Andreae (Parallax)) : 11/3/2009 9:02:44 PM GMT
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-11-03 21:44
    Peter, Are you any closer to your goal, "how would you describe Spin as language and do so succinctly and positively?". I for one am curious what you come up with for a short list and whether it is generic or audience-specific. For me the essential features are quick prototyping, short learning curve, modularity, small footprint, and closeness to the power of the unique hardware.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • RossHRossH Posts: 5,516
    edited 2009-11-03 21:49
    @all,

    Yes, by all means let Peter get his thread back!. I like Tracy's definition of SPIN since it completely avoids any references to other languages. That should save on arguments!

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • whiteoxewhiteoxe Posts: 794
    edited 2009-11-04 00:47
    I remember being taught VB6. The Synopsis explained VB6 would be used to teach us OOP. The lecturer/tutorial leader I had was cranky it had been described as an OOP language, he had wanted us to learn Smalltalk which was axed. For my part I didn't care I just wanted to learn any language. The basics of getting started in Spin to get anything done felt easier than BASIC. I am in awe of the depths of understanding some of you have of languages. Seems of course the more you know the polarized the opinions.
  • jazzedjazzed Posts: 11,803
    edited 2009-11-04 02:46
    _spinner said...
    Seems of course the more you know the polarized the opinions.
    This is a great observation. I used to write PHP while wearing Ray-Ban sun glasses scool.gif
    Some people make their living writing one language or another; that *can* damage objectivity.
  • PavelPavel Posts: 43
    edited 2009-11-04 04:10
    Seems of course the more you know the polarized the opinions.

    In my experience, this is a lot more seen on INTERNET forums than in the world of professional software development. I work as a professional software engineer since 1996 and no matter what project I worked on, the choice of the language always came out of the analysis of required product features, targeted platforms and intended market. Once that decision is made, it's pretty much "learn or quit" and life's a lot easier if you maintain pragmatic attitude.
  • RossHRossH Posts: 5,516
    edited 2009-11-04 04:39
    @Pavel,

    Wow - you're lucky! You are entirely correct that the logical choice of language comes out of the analysis of required product features, targeted platorms and intended market - but in my experience most projects then go ahead and implement using something completely different anyway. Lots of reasons for this - either because it's all that is available, or all the customer is willing to pay for, or because the customer specifically demands it - often contrary to all logic and reason.

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • max72max72 Posts: 1,155
    edited 2009-11-04 21:33
    I would like to add my experience on Spin.
    I programmed in the past with many language but I have never been even a decent programmer in anyone.
    I usually made what I had to do with the tool that at the moment looked a good solution.
    For instance matrix calculations with Matlab/Scilab, GPIB interfacing with C/C++, string handling with Perl or even Vi, and so on.
    All the times I tried to combine the usual programming structure (If,while,operators..) with the strength/weakness of the tool I had. The usual structures required only to adapt to the new syntax, while the other aspects are unique of every tool.
    I cannot even understand many of the aspects discussed here, and even less have an opinion, but for my programming/user level the same problem still applies. The basic structure is more or less the same, only syntax changes, while the specific aspects are unique by definition. Even moving between basic stamps versions requires adapting.
    Spin from my point of view is just another tool, even if really pleasant. Moving to is has been straightforward. Moreover it looks like the right tool for the Propeller, because it works smoothly, and I was able to use it in no time.
    On the other hand the aspect required time to adapt to is the multicog structure, but I guess is language independent.

    Bottom line: As a casual user I'm happy there is Spin, I use it, and I would describe it as a language similar to many others but the right one for the Propeller... probably not what you could write in an official doc...

    Massimo
  • Martin_HMartin_H Posts: 4,051
    edited 2011-03-11 18:13
    I know this is an old thread, but I'm late to the Propeller/Spin party. This week I read through the Propeller tool manual and learned Spin. I also finished my first real Spin program. The experience made me wonder what other people thought of the language, so this was an interesting read.

    What do I think of Spin?

    When encountering a new language I rate based on how fast you get past the language syntax and start dealing with the underlying semantics. I'd put Spin in the Algol family, with decent control structures, so it's approachable. The ability to bit twiddle is a strong point for the niche it is in.

    But In places I think it is unnecessarily terse (e.g. ^^ for square root and || for absolute value). The lack of type safety is a potential source of drama, so that's not great. Finally using { } for a comment block is just plain cruel to C family language programmers.

    So I would rate Spin well above APL (a mistake carried out to perfection), but below Java/C# (C family languages with fewer annoyances). BTW Logo/Lisp are my favorite languages, both are vastly underrated, and Logo is mostly forgotten now.

    While I can deal with Spin, I can see how it could be a barrier to Propeller adoption. Generally if someone has an algorithm in a more commonly used language, they're not going to see it as a selling point that they'll need to translate it to a new language.
  • DavidMDavidM Posts: 630
    edited 2011-03-11 19:59
    I daily switch between programming in SPIN and REALBASIC, While they are different, I find that they are similar in coding style. eg, METHOD CALL's are similar, Decision logic, IF, CASE , COMPARISONS are similar, both need indenting, SPIN sort of has OBJECTS, Spin sort of has DOT NOTATION, but no AutoComplete, the main difference is GLOBAL Variables, In REALBASIC Globals are TRUE Globals, In SPIN, Globals are only global to the OBJECT, so you have to pass a lot of parameters, not too hard, but can be tricky because of the variable types, mainly STRINGS and LONGS.

    I believe that IF a real-basic user wants to get into micro controllers, then learning SPIN should be easy.


    Just my opinion.

    Dave M
  • Heater.Heater. Posts: 21,230
    edited 2011-03-11 22:21
    DavidM,
    ...but no autocomplete.

    why are people often confusing language features with IDE features?

    Objects and dot syntax are a feature of the language. Auto complete is a featute of the IDE.

    I'm not getting at you David, it's just that I have seen this a lot recently.

    Seems that programming languages are increasingly being judged by the tools provided to edit them rather than the intrinsic qualities of the language.
  • DavidMDavidM Posts: 630
    edited 2011-03-11 22:35
    Hi Heater,

    SPIN is both a LANGUAGE and an IDE as far as I am concerned, AutoComplete to me seems a logical addition when using dot notation.

    If you are hearing this a lot then maybe people like It!

    regards

    Dave M
  • AriAri Posts: 63
    edited 2011-03-11 22:37
    Since the original topic asks for an opinion, let me state mine. SPIN has no basis in other language attributes. Therefore it is proprietary in nature. Like any proprietary language it is closed and limited. I am certainly not saying it is a "bad" language. I think anyone who knows would agree that ALL languages have their limitations (well maybe not pure logical languages, but I know of non that exist).

    The closed nature of the propeller and SPIN really takes it out of the hands of people who need to have low level function for professional reasons. In a professional development environment we are governed by protocol and consistency. Although the system you are working maybe be old and limited, if you did not employ it you would wind up being Parallax. A company that only has 2 people developing their proprietary platform.

    I am by no means bashing Parallax or any of their products. I think the Propeller is wonderful as a concept. It utterly fails as a professional solution though. If you are one guy trying to develop physical realities in an unlimited time frame, then the Propeller is marvelous. If you are working on a standards based team, and need to compile existing objects into your new platform, the Propeller is worthless.

    I wish a simple electrical specification sheet would be provided by Parallax. Designing a platform based on a Propeller (from scratch) has become impossible for me, and I have abandoned the Propeller as anything other than a fun toy to play with. I have more options from an archaic 8bit PIC than the Propeller. That is SAD.

    The main reason for this is NOT the Propeller itself (arguably) but it's failure to adopt a standard and assimilate existing objects.

    I have to agree with Nick about the byte, word, long thing. A word is a string, regardless of bit depth. To call it anything other than that is illogical. Then again debugging all code that exists in your pool because a word has become something new, is also highly illogical. In plain technical accuracy though, a word is NOT 16 bits, it is a variable attribute. To make an exception is (once again) illogical.

    *sigh* we are human though......
  • DavidMDavidM Posts: 630
    edited 2011-03-11 23:20
    Ari wrote: »
    . It utterly fails as a professional solution though.

    Hi Ari,

    That's bit harsh mate!

    Last nov/dec 2010 we sold 40K worth of PROPELLER BASED Products!

    Hardly a toy mate!

    Dave M
  • AriAri Posts: 63
    edited 2011-03-11 23:24
    DavidM wrote: »
    Hi Ari,

    That's bit harsh mate!

    Last nov/dec 2010 we sold 40K worth of PROPELLER BASED Products!

    Hardly a toy mate!

    Dave M


    and how many people are on your development team? and do you employ an operating system?

    toys-r-us sells well over $40k worth of products monthly.....income stream hardly makes a product professional....and not to diminish your revenue, but $40k is small potatoes....intel based products sell $40k per minute (if not more)....and I would argue that most other MCU based products outsell anything based on the Prop.

    when I see a prop in a product that is being sold in a local retail chain....I will agree with you

    like I said I am not bashing the Prop. I am here on the forum with you....and I have a few prop based toys sitting in front of me....but go out into the real development world and try to use existing objects to build on and see what happens.....

    If Prop. could ingest objects from Java then I would change my opinion (I am not claiming that is the mark of a professional development tool)....until then....it's a toy and best suited to small operations, in which you can build from scratch....not everyone is willing or able to start from scratch.....

    would you suggest that established companies drop their openly supported platforms for the power of the prop? we are talking time line here

    how long did it take you to develop your product...vs. developing on an open platform?

    I don't think we are on the same page Dave...and by that I don't mean to make any less of the prop. or you or your success....I am just talking about reality and the reality of doing development with existing objects.....
  • DavidMDavidM Posts: 630
    edited 2011-03-12 01:46
    but $40k is small potatoes

    hey Ari, Smile off, mate!

    Your last post is totally offensive ! I am holding back my REAL Reply!
  • Heater.Heater. Posts: 21,230
    edited 2011-03-12 02:17
    Gentlemen, please let's have some decorum here.

    Why does a programming language debate on the net always decend into the swamp?

    We know the other parties are always wrong in such a discussion. It's par for the course:-)
  • cdecde Posts: 37
    edited 2011-03-12 02:25
    To answer the original question:

    with a BNF ;)

    A good point of comparison is the Go language specs, very detailed and informative:

    http://golang.org/doc/go_spec.html

    I am unaware if there is a similar spec for Spin.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-03-12 02:48
    My dad could beat up your dad!! Seriously, it amazes me how quickly these discussions turn into philosophical fist fights.

    I for one hated Spin early on, but have gotten used to it. I come from a C++ & C# background, and a number of the operators in Spin do completely different things than those same operators in C++. Not a design choice I would've made, but who's to say it's "wrong"? It takes some getting used to, but a good programmer can adapt to a new language fairly quickly.

    I will agree that a C like compiler that produced Spin byte code (if such a thing is even possible) would probably encourage more professionals to look at the Prop, but I also think that the architecture of the Prop is fairly unique, and Spin produces compact code that is well suited to that architecture. If those professionals were a little more open minded, they might find the Prop to be quite elegant. I love the fact that there are no interrupts, and that I have a fully configurable set of peripherals to work with, instead of 40 variants of the same chip. It comes with some quirks. What doesn't?

    Given the price point and memory restrictions of the Prop, it's going to be a bit of a niche chip in the commercial world anyway.
Sign In or Register to comment.