Parallax Forums
  HomeLog InRegisterCommunity CalendarSearch the ForumHelp
   
Parallax Forums > Public Forums > Propeller Chip > How would you describe Spin as a language?  Forum Quick Jump
 
New Topic Post Reply Printable Version
110 posts in this thread.
Viewing Page :
 1  2  3  4  5 
[ << Previous Thread | Next Thread >> ] | Show Newest Post First ]

Chip Gracey (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2004
Total Posts : 978
 
   Posted 11/2/2009 8:26 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Spin is the product of both love and hate.
 
 
Some loves:
 
1) Terse, but obvious, coding syntax - so it's easy to learn, write, and read.
 
2) Keeping binary phenomena unobscured - it's the way that computers really work and pretending otherwise leads to trouble.
 
3) IF, CASE, REPEAT - do you really need anything else?
 
4) \method and ABORT - all that is needed to pop you out of deep holes.
 
5) Encapsulation of code & variable modules - made especially useful in multi-processing.
 
6) Functional documentation embedded in source code, being instantly extractable.
 
 
Some hates:
 
1) VARIABLE TYPES - they've presented nothing but headaches to me in other languages, never an advantage, and never "safety", just fun-killing rigidness that often requires digging to get around. I think being taught to program within the myriad of strictures presented by typed languages is a sure way to build blockages to true understanding of computing in a person. The only meaningful delineation I see is between bit-lengths (with some particular length being perfect for pointers, which can, incidentally, point to z-strings). Everything else would come at the expense of subtle expression syntax rules for each class of type. No thanks!!!!! A float type may be a worthy exception. Structure support would be a useful addition to Spin, for sure.
 
2) TYPING ANYTHING TWICE - header files and function prototypes are unnecessary, redundant drains that kill the joy of programming. Imagine having a hobby, but then remembering that before you engage in it, you must fill out government paperwork on each occassion. No way.
 
3) "Properties" getting squirreled away in oft-HIDDEN MENUS, particulary within flaky IDEs. I'll take a source code file any day.
 
4) HIDDEN LIBRARIES of possibly rotten code. You should be able to see what's going into your project, and this is often necessary, anyway. Programming Windows can be like trying to build a jet engine from parts you buy at WalMart.
 
 
There's a lot more, but that's all I have time to write now.


 
Chip Gracey
Parallax, Inc.

Post Edited (Chip Gracey (Parallax)) : 11/3/2009 4:40:11 AM GMT

Back to Top
 

Cluso99
We live onboard



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2008
Total Posts : 2277
 
   Posted 11/2/2009 9:12 PM (GMT -8)    Quote This PostAlert An Admin About This Post.

Thanks Bill... I think I might be one of the lunatics too  confused

I think (well I hope) that we know when to use spin and when to use PASM (or LMM, etc). And in many cases it's OK to use spin to test a theory and if more speed is required, convert it to PASM.

Chip: Thanks for your comments too. There has been a lot of flack in this thread. SPIN is fantastically simple provided you keep the summary nearby for the obscure operators. SPIN is just so simple to get started.

How many micro chips can you get running with a couple of statements? I only know of ONE. Each time I think about other micros, I remember the time it takes to get a basic set of instructions working. Admittedly, you only have to do this once for a shell, but you do have to get all the register hardware definitions setup before the micro will do anything simple, even flash a LED. The prop can turn a LED on in 2 lines (DIR and OUT).

How simple is this to make a LED flash (the repeat 10000 may need adjusting - I haven't tried it)

Pub Main            'make a LED flash
  dira[23] := 1     'make pin 23 output (has resistor and LED attached
  repeat
    outa[23] := 1   'pin 23 = 1
    repeat 10000    'delay
    outa[23] := 0   'pin 23 = 0
    repeat 10000    'delay
I used SPIN to write my SPIN & PASM Debugger. Why? It was simple, easy to understand, and when you are debugging you do not need it to be fast.
 
Heater & I use SPIN for the slower sections of ZiCog - the actual hardware emulation and the initialisation sections. The Z80 instruction emulation is of course in PASM.


Links to other interesting threads:
Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13558
 
   Posted 11/2/2009 9:46 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
I hear a lot of grousing about the speed of Spin. There are an awful lot of tasks where Spin is more than fast enough. For goodness sakes, Spin code can do half duplex 19200 Baud serial. Canned objects with the low level stuff done in assembly take care of a lot of the tasks where Spin isn't fast enough and it doesn't take a lot of assembly code at that. Look at what was accomplished with the hardware Z80 and instructions that executed in about the same order of magnitude as the more complex Spin bytecodes. Sphinx is a good example of what low level (and some high level) functionality can be moved into the cogs' memory to free up hub memory ... TV text output (with the screen buffer in the cog), a keyboard driver, and an SD card filesystem, all in 5 cogs.
Back to Top
 

RossH
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2008
Total Posts : 411
 
   Posted 11/3/2009 2:33 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Mike, Chip ...

I don't disagree with either of you - the Prop is excellent at what it was designed for (as well as many things it wasn't) - and SPIN is the ideal language for many Prop developments. And as Chip points out, it certainly does bring joy back to software development.

But for large and complex apps? No, I wouldn't choose SPIN for that. There I want as much help as I can get from my toolset - if I can get it, I would always opt for absolute type safety, enforcable interface contracts, and as much information hiding as I can possibly get. Not to mention platform independence, resuable libraries, and generic programming. Not for any idealogical reasons - just because decades of hard slog eventually taught me that these things can increase my own productivity many, many, many times over.

But I accept that my needs and wants are not the same as all Prop users - possibly not even a significant minority. And it is a credit to Chip and Parallax that we are now having these discussions about a microcontroller costing a few dollars. I remember the days when squeezing a general purpose computer in a single room was a big deal. Then a single cabinet. Then a single board. Now a single chip. Where to next?

Ross.

P.S. If A = float and B = structures, then of course SPIN + A + B = C :-)


Catalina - a FREE C compiler for the Propeller - see Catalina

Back to Top
 

Nick Mueller
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2007
Total Posts : 697
 
   Posted 11/3/2009 2:53 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
> In support of this I would like you to login to any Linux box and have a look at the header file for one of the most basic and
> widely facilities in C. That is the ISO C 99 standard /usr/include/stdio.h.

Heater! That was a good argument! :-))
The problem is, that it has to be very configurable for different models. But if you go back to your own little world, things are much easier. Even in big projects (in C++) with many man-decades of work I do not recall header-files like the one you cited.

> With the Propeller, it's known the longer term outlook is not to abuse peoples investments, ...

Full ACK!

> To do ANYTHING in C you need header files.

For your own code? Thats dead wrong, even if you change you font to 34 points.

> "Ok I will make a decision for you. 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".

You are running out of arguments again? Not the first time that I have to read such a nonsense from you. I already gave the advice which route to take, that doesn't require a psychiatrist in your wrong metapher.


Nick


Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO

Back to Top
 

SamMishal
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2006
Total Posts : 330
 
   Posted 11/3/2009 3:41 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Nick Mueller said...
> To do ANYTHING in C you need header files.

For your own code? Thats dead wrong, even if you change you font to 34 points.

I defy you to show me ANY C program that does any kind of minimal user I/O that does not requires a header file usage.

 

To qualify for the challenge I or anyone has to be able to cut and paste the code you give us AS IS without any additions or modifications into a C compiler and be able to compile and run it.(BTW pasting the header file inside the program as a whole is a cheat and is not allowed).

 

Here is a pseudo code for a minimal program ..... I defy you to implement it in a C program without having to use a header file.......I mean without an #include of any kind.

 

==============

Prompt user for  a name

Obtain the name

Prompt the user for year of birth

Obtain year

Calculate Age

Display "Hello "+User Name+" you are "+Age+" years old"

==============

 

Very simple...no? If you can show me a program that implements the above pseudo code without having a single #include in it ..... I will retract my words....if not then you must admit that saying "Thats dead wrong" is dead wrong.............

 

Or even better......show me a program in C that can accomplish what Cluso99's program shown above in Spin does. And I mean flashing an actual LED not a screen simulated one. But I will grant you a simulated screen one too.

 

If you can show me a C program that can do that without the use of any #include files then you are a GURU.

 

Sam

 

Post Edited (SamMishal) : 11/3/2009 12:18:47 PM GMT

Back to Top
 

Baggers
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2007
Total Posts : 1773
 
   Posted 11/3/2009 3:43 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
My turn for a 2p's worth :D

The way I see it is Spin is not only the glue but also the candy that entices newcomers til they feel confident/comfortable enough with to then jump into PASM.

It has more than enough features to carry out the many many tasks we throw at it, you only have to look at the amount of apps the prop has to see how good it is.

Also, for example, proof of how good it is, I originally started microcontroller coding on the PIC chips, thanks to Rickard Gunee's console web site, I then got a Velleman pic programmer board from Maplin and got into that, learning the fuse setting etc was a PITA, when swapping to a different PIC cos I needed more speed having to re-learn the fuse settings etc, and then realising that there was bugs in the serial side of the chip, and having to work around that. then I came across the Prop, which is a LOT faster than any pic, yes it may have 40 mips, bit you can't have 8 of them going at once :D anyway, to me, Spin was the Candy, as it's so easy to learn and pick up, yes I do have the advantage like most of you here, that I've been professionally programming for 24 years, and as a hobby for 4 years prior to that, while I was still at school, so yes, it was easier than a total noob, again, back to spin, if you needed more speed, like with pics, or an extra function you don't need to get a different pic, and have to re-learn setting it up etc, you can jump into PASM, there are tutorials on here, and a LOT of people who can help.
Also again with the joy of Spin and the prop in general, a while back, I very very briefly looked at another microcontroller, Leon may tell you what it's called now and again, but I won't here, anyway, I looked at it, and didn't like coding it at all, it was too much messing around to do what you want it to do, and you don't really have a clue of how the memory is laid out, or split, so it now gathers dust ;). To me, the prop is EXACTLY like what it says in one of the first advert picture I saw for it, can't find the pic, just looked now, google is not my friend today lol, anyway it was along the lines of, bringing back the good old days when programming was fun. :) it's certainly been a joy to write everything that I've done on the prop, and everything that I'll do in the future also.

Well that's my 2p's worth anyway :)

Baggers.


http://www.propgfx.co.uk/forum/ home of the PropGFX Lite
 

Back to Top
 

Peter Jakacki
thinker tinker



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Sep 2006
Total Posts : 936
 
   Posted 11/3/2009 4:01 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
I way I see it there are no fools here, we are certainly not normal though, otherwise we would not be using that gimmicky and "amateurish" Propeller chip.

So the fact that we are Propeller people is not a good thing in the eyes of the "normal" people. How they must look at us both with disdain and wonderment.

What in blue blazes is going on here! Last time I looked at a propeller (the real thing) it had multiple blades, not all of them were on the same side either. I think they do that for function and balance.

Do we all drive the same car? No!
Do we all speak the same language? No!
Do we all like the same food? No!
etc etc
Do we all like the Propeller? Yes!

See, we don't have much in common except this odd little chip and it's rather odd way of doing things. I don't have a problem with that because this odd little chip actually works, rather surprisingly well in fact, and goes on surprising. In turn I have come to appreciate the whole package and I don't think the Prop would be the same without Spin. In turn every computer language has it's deficiencies, it's just that we get used to them, like English, but to us English speakers it's our "preferred" choice, it's natural for us, whether it's good or bad as a language in the eyes of others, it doesn't matter.

But Spin is simple enough yet powerful enough to let the creative juices flow so to speak without the conventional overheads that stop you in your tracks making you do it the "right" way or conversely too simple that you run into a brick wall. Yep, I can see a lot of shortcomings with Spin, but absolutely anybody can see that as there has never been a language that has been exempt. Being able to see the potential and make use of it is what we have been doing and that sets us apart from those other forums that are bogged down with debugging and trying to convince their mainstream language and tools to blink an led. This Propeller forum is a direct reflection of that creative energy, let's channel it, together.


*Peter*

Back to Top
 

SamMishal
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2006
Total Posts : 330
 
   Posted 11/3/2009 4:08 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Nick Mueller said...
You are running out of arguments again? Not the first time that I have to read such a nonsense from you. I already gave the advice which route to take, that doesn't require a psychiatrist in your wrong metapher.

As a metapher my metaphor might be wrong.

 

But as a metaphor you have not gotten the point. Your advice is not necessarily the one I want to go with. I want to be able to do my own thinking by myself. I want the freedom to do what I want. I do not want to be restricted by people who think that they know what is best for me and everybody else.

 

I want a system that allows freedom of choice. I am able to decide by myself and am able to take the responsibility for my own action.

 

 

Sam

Back to Top
 

RossH
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2008
Total Posts : 411
 
   Posted 11/3/2009 4:36 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
@SamMishal ...


#define HMI 1

extern long _sys_plugin(long code, long param);

int _short_plugin_request (long plugin_type, long code, long param) {
    return _sys_plugin (plugin_type, (code<<24) + param);
}

int k_wait() {
    return _short_plugin_request(HMI, 3, 0);
}

int t_string (unsigned curs, char *str) {
   return _short_plugin_request(HMI, 23, ((curs&1)<<23) + (int)str);
}


void main() {
   char name[10];
   int i;
   t_string(1, "enter your name\n");
   for (i = 0; i < 9; i++) {
      name[ i ] = k_wait();
      if ((name[ i ] == '\n') || (name[ i ] == '\r')) {
         break;
      }
   }
   name[ i ] = '\0';
   t_string(1, "hello ");
   t_string(1, name);
   t_string(1, "\n");

   /* etc etc */
}



Compiles with catalina and runs on the Prop (I tried it).

I'll leave it to you to add the rest of the logic you wanted.

Ross.


Catalina - a FREE C compiler for the Propeller - see Catalina

Back to Top
 

Nick Mueller
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2007
Total Posts : 697
 
   Posted 11/3/2009 4:49 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
> Here is a pseudo code for a minimal program ..... I defy you to implement it in a C program without having to use a header file.
> ......I mean without an #include of any kind.

You challenge is to have multiple files without any #include?
Quite funny!
I'm giving that challenge back to you to do it in SPIN. Also without any kind of '#include' (read 'object').
Now if you end up with a c & p of all needed files into one single file, you shouldn't be too challenged to do the same in C.


> If you can show me a program that implements the above pseudo code without having a single #include in it .....
> I will retract my words....if not then you must admit that saying "Thats dead wrong" is dead wrong.............

What's your challenge? I wrote "own libraries". Not those of others, simply because they were written to work with header-files. HEADER-FILES, not includes!

Do yourself and the readers a favour: Read the posts of others and re-read your own posts before you hit return!

EOD for you now!

Nick


Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO

Back to Top
 

SamMishal
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2006
Total Posts : 330
 
   Posted 11/3/2009 5:31 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
#define HMI 1

extern long _sys_plugin(long code, long param);

int _short_plugin_request (long plugin_type, long code, long param) {
    return _sys_plugin (plugin_type, (code<<24) + param);
 
[....]

Hi Ross,

 

I think the Catalina is AWESOME........How is the BOLDED extern resolved upon compiling? What do I use for input and output?

 

Unfortunately I cannot try the program. I am not versed with the Catalina. But I think that you can do such a thing on the Propeller is a wonderful testament to the Propeller.

 

I can do the above very easily with Spin too and I can do it on any platform for the propeller. I can use FullDuplexSerial which is my favored method since I can do both Keyboard Input and Screen output all in one cog and on the development platform.

 

I can use TV_Text/ VGA_Text and Keyboard.....but then I have to wire up and plug in a keyboard and a TV/VGA screen.

 

But the point is that SPIN gives me the choices and the abilities to do things the way I want.

 

Also I am very interested to see the equivalent to Cluso99's program above in Catalina.

 

I do admire and applaud your work with the Catalina.....if I get the time some time I WILL DEFINITELY try it out....it is worthy of admiration......

 

Unfortunately I have limited time.....I do not know how you guys on this forum can manage such AWESOME work and still SLEEP.

 

A very important point HOWEVER.....I picked up the Propeller and with Spin in a day I was able to write programs that accomplished AMAZING things that had me jumping for joy at what I saw being done. (e.g. blinking two LEDs totally independently with their own timing).

 

If I were to do the same with anything other than SPIN I would have not done it in a DAY....A DAY......this is the MOST IMPORTANT thing about SPIN.............any one can pick it up and be productive on the propeller with it IN A SHORT TIME............later if one requires more power he has the CHOICE to use PASM and the FLEXIBILITY of the OBEX objects and and and..........

 

 

So SPIN is  EASY, CAPABLE, and is the best way to get things done with the propeller even for a novice to  programming.

 

The main thing is that it allows FLEXIBILITY combined with ABILITY.

 

Sam

Post Edited (SamMishal) : 11/3/2009 2:12:04 PM GMT

Back to Top
 

SamMishal
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2006
Total Posts : 330
 
   Posted 11/3/2009 6:08 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Nick Mueller said...

Do yourself and the readers a favour: Read the posts of others and re-read your own posts before you hit return!

I am reading your posts.......I find nothing but insulting critical naive nonsense...........here is one .....

Nick Mueller said...
Spin is a basic patchwork of different languages. The result is:
* 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 crap, but it works and its a compact language. And only worth learning because it comes along with the processor.


Nick

I don't see anything designed by you.... the almighty GURU.......and I am sure it would be crap anyway...............

 

At least Chip has designed something USEFUL and WONDERFUL (despite your opinion) and is ENABLING people to ACHIEVE things that are amazing.

Whether SPIN meets YOUR faulty standards or not it is immaterial. It WORKS and works VERY WELL at that.

 

So when you PRODUCE something as good or better .....come back and talk to us......for now you are irrelevant....

 

Sam
 
Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13558
 
   Posted 11/3/2009 6:45 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
@Sam & Nick - These forums are supposed to be a place for civil discourse. People can have strong disagreements and, at some point, maybe should agree to disagree, but be careful about personal attacks.

@Nick - My graduate school advisor was an expert in computer graphics among other things and was the head of the Computer Science department. He happened to be blind since childhood and thought of that as an advantage since he wasn't constrained (in terms of the graphics area) by what he could see. 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. 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.
Back to Top
 

RossH
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2008
Total Posts : 411
 
   Posted 11/3/2009 6:49 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
@Sam,

The _sys_plugin function is not a normal function - it is Catalina's equivalent of a "supervisor call" - i.e. a direct call into the Catalina kernel. This is a standard technique for giving programs (especially C or assembly programs) access to underlying system functions (see here).

If you know how to invoke supervisor functions you can do much the same thing on most C compilers (this is one reason C is usually considered a low level language akin to assembler, and not a high level language at all). Because the mechanics are different on every machine they are usually hidden from the programmer inside various library functions. All I am doing here is invoking them directly.

In this case I am using the _sys_plugin call to invoke a couple of functions provided by Catalina's HMI (Human Machine Interface) plugin - a "plugin" is just a driver (or some other helper program) which runs in a separate cog and is known to the kernel - effectively "extending" the kernel. Catalina provides a very simple but standard interface that all plugins use (other examples include various floating point libraries, the SD card access functions and the real time clock). The HMI plugin provides all the basic terminal I/O functions which underly the more traditional C library functions like "printf". All C compilers (at least all ANSI C compilers) must provide the same set of such functions. They should really be considered part of the language.

Ross.


Catalina - a FREE C compiler for the Propeller - see Catalina

Back to Top
 

QuattroRS4
Soldier Of Fortune !



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2006
Total Posts : 877
 
   Posted 11/3/2009 6:55 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
@Sam and Nick - Come on lads leave it out ! - this is not what the forum is about.


'Necessity is the mother of invention'
'Those who can, do.Those who can’t, teach.'
'Convince a man against his will, he's of the same opinion still.'
 
 

Back to Top
 

Chip Gracey (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2004
Total Posts : 978
 
   Posted 11/3/2009 7:09 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
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

Back to Top
 

Nick Mueller
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2007
Total Posts : 697
 
   Posted 11/3/2009 7:22 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
> 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. ;-)

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! ;-) 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

Back to Top
 

Nick Mueller
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2007
Total Posts : 697
 
   Posted 11/3/2009 7:31 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
> @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 piss*ed of people like these!


Nick


Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO

Back to Top
 

potatohead
640 Pixels... :)



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Sep 2006
Total Posts : 1340
 
   Posted 11/3/2009 7:54 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
...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

Back to Top
 

João Geada
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Sep 2007
Total Posts : 55
 
   Posted 11/3/2009 8:07 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
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ão

Back to Top
 

Kye
Kwabena Agyeman



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2008
Total Posts : 620
 
   Posted 11/3/2009 8:24 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
This tread is starting to degrade with the usual stuff. Better to lock it down now.


Nyamekye,

Back to Top
 

Dave Hein
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2006
Total Posts : 207
 
   Posted 11/3/2009 11:39 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
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[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);
}
Back to Top
 

jazzed
_oOo_(^^)_oOo_

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2008
Total Posts : 2114
 
   Posted 11/3/2009 12:15 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Someone needs a 34 point bold font eraser lol
Back to Top
 

Dave Hein
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2006
Total Posts : 207
 
   Posted 11/3/2009 12:27 PM (GMT -8)    Quote This PostAlert An Admin About This Post.

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

Back to Top
 
[ << Previous Thread | Next Thread >> ]
New Topic Post Reply Printable Version
110 posts in this thread.
Viewing Page :
 1  2  3  4  5 
 
Forum Information
Currently it is Saturday, November 21, 2009 11:23 AM (GMT -8)
There are a total of 393,852 posts in 55,536 threads.
In the last 3 days there were 84 new threads and 703 reply posts. View Active Threads
Who's Online
This forum has 17692 registered members. Please welcome our newest member, old guy.
43 Guest(s), 18 Registered Member(s) are currently online.  Details
heater, MichelB, Peter Jakacki, keith_kw, Jay Kickliter, Mike Green, Alsowolfman, Shawn Lowe, Luis Digital, dMajo, Harley, Sapieha, Harprit, Rick Brooks, Beau Schwabe (Parallax), SRLM, Tubular, ERM