[plt-scheme] Suitability of typed scheme for replacement of c language for microcontrollers
On Sun, 2010-02-21 at 19:49 -0500, Sam Tobin-Hochstadt wrote:
> On Sat, Feb 20, 2010 at 10:44 PM, Seth Burleigh <seth at tewebs.com> wrote:
> > On Sat, 2010-02-20 at 22:12 -0500, Neil Van Dyke wrote:
> >> I wasn't thinking that
> >> static typing is necessary, and I don't need "call/cc" directly, but I
> >> am concerned about GC (its resource demands, and doing it with real-time
> >> constraints).
> > There actually already exists scheme for PIC microcontrollers.
> > http://repo.or.cz/w/picobit.git
> >
> > The reason i was considering a typed scheme is that i have to program in
> > c anyways and a typed scheme wouldn't make much a difference except that
> > it could do macros - a big advantage - and it would have the same
> > potential for speed as c does.
>
> It would be a mistake to think that Typed Scheme has a natural mapping
> onto either C or a microcontroller, or that it would make your code as
> fast as C. Typed Scheme is designed for Scheme programs and Scheme
> idioms, not C.
>
> If what you want is C with Scheme macros, I would write an sexp-based
> C language using PLT, and use that to generate C code.
I agree after looking more closely at typed scheme. I played around with
how i would write a c based sexp language for avr microcontrollers and i
came up with some sketches mapping c code to a sexp language and adding
types
doesn't seem to clutter the code if some simple (well maybe not simple)
type inference is done. Especially if inlined c is allowed
anywhere.
Of course there will be no continuations or such. However, I have
noticed that in avr-gcc it is possible to allow anonymous functions and
an extremely limited form of closures for the functions via nested
functions.
Thanks for all the input!