----- Forwarded message from Tomasz Rola <rto...@ceti.pl> -----

Date: Mon, 2 Jan 2012 05:15:03 +0100 (CET)
From: Tomasz Rola <rto...@ceti.pl>
To: Kragen Javier Sitaker <kra...@canonical.org>
Cc: Tomasz Rola <rto...@ceti.pl>
Subject: Re: Arduino frustrations: C is not a higher-order language, and
        timing is not an optimization

On Sun, 1 Jan 2012, Kragen Javier Sitaker wrote:

> So playing with Arduinos, and helping other people do it, I'm struck
> by how many unnecessary problems we're still struggling with.  For
> example:
> 
> - The heap grows up and the stack grows down, and there's no memory
[...]
> 
> - You'd really like to do that allocation at compile time so you can
[...]
> 
> - More than allocating memory, I'm allocating *time*.  I noticed
[...]
> 
> - And I'd like to construct routines at compile-time by traversing
[...]
> 
> - In general, C is not suitable for timing-accurate code for this
>     reason.  But doing it in assembly is crappy.
[...]
> 
> - There's normally no multithreading; although there are libraries
[...]
> 
> - There's a storage class qualifier ("PROGMEM") for data that end up
[...]
> 
> - On an 8-bit processor, performance is quite dramatically affected
[...]
> 
> So the upshot is that I end up doing a lot of stuff either by hand
> or at runtime that I'd like to do automatically at compile time, and
> then I have to debug problems by trial and error instead of getting
> useful error messages.

Hello,

I have subscribed to some (maybe all - don't remember ATM) of your lists.

Perhaps you are enough frustrated to consider Forth?

I'm no expert on Arduinos, and not much knowledge of Forth either, but 
reading Arduinos' specifications so far lefts me with impression that 
maybe C is a bit too big for them.

Google says there is some work on making Forth, but I didn't tried it (it 
would be hard without buying my piece of hardware, but buying would mean 
dedication and I really don't have so much time).

Unfortunately I don't have much more to say on this. I must sound lame :-)
but if there is a chance you never heard of Forth, here is my chance to be 
helpful. Yes it looks strange. And I tried it a bit and it is quite good 
thing for a strange language. Actually, I get many "aha moments" reading 
about Forth and many surprises...

If nothing else, your problem with memory management would go away in an 
instant :-) because there is only stack AFAIK. There may be ways for using 
other locations (never read that far) but the simplest subset of language 
does everything using stack only.

As far as I can say, Forth is much better language than C for something 
this simple.

Hope I am not wrong :-). Probably not.

Regards,
Tomasz Rola

--
** A C programmer asked whether computer had Buddha's nature.      **
** As the answer, master did "rm -rif" on the programmer's home    **
** directory. And then the C programmer became enlightened...      **
**                                                                 **
** Tomasz Rola          mailto:tomasz_r...@bigfoot.com             **

----- End forwarded message -----
-- 
To unsubscribe: http://lists.canonical.org/mailman/listinfo/kragen-discuss

Reply via email to