world as value

Marco Kesseler mke@oce.nl
Tue, 29 Jun 1999 09:26:12 +0200


Adrian Hey wrote:
>On Wed 23 Jun, Marco Kesseler wrote:
>> >What I want to do is describe my entire system in 1 language. 
>> 
>> Again, I mostly agree with you, but one thing makes me wonder.
>> Why is it so important to write the entire system in 1 language?
>
>I can think of 2 good reasons..
>1 - Idealism. I don't just want to implement systems. I want to reason about
>    them. I don't think this is easy if 2 languages have different, possibly
>    incompatible semantics.

That is one of the reasons why I would be so pleased if it were possible
to call Clean from C easily: it would (or should) NOT be a 'semantic' problem.
In contrast, calling C from Clean remains troublesome, because it is
hard to ensure that a C routine is truely a pure function.

And yes, this will not lead to a better way of reasoning about the
imperative parts of my program, but at least it is semantically sound
to call functions from C and apply 'functional' reasoning locally.

>    Cross language optimisation would be a nightmare too.

Maybe, but I really wonder whether this will turn out to be such
a big issue.

If not, two approaches already come to mind.
- Haskell translates to C, so perhaps the C compiler can do the
  cross-language optimisations.
- certain mixtures of functional code and C might be translated into
  a functional expression that explicitly passes state, or uses monads
  This can then be optimised by the functional compiler.

>2 - Compatability of run time systems, data structure representation etc.
>    Could I reasonably mix Clean and Glasgow Haskell for instance? I suspect
>    I would find this very difficult. I could have two separate programs in
>    my system, one written in Clean and the other in Glasgow Haskell and use
>    the OS to interface them (assumming there is an OS, often there isn't in
>    embedded sytems). This would probably be safe, but awkward.

Mixing Clean and Haskell may be easiest by translating the source
code.

W.r.t. mixing Clean (or Haskell) with C:
- I wonder what an OS would have to do with it.
- If data conversions would be done automatically, it would not be
  awkward.
- would it be a big problem for a C programmer to use (or convert
  to) data structures that can readily be offered to Clean?

>BTW, I'm going away for a couple of days, so this will be my last message on
>this thread for a while. See you when I get back if it's still going. 

Well, I waited.

regards,
Marco

---------------------------------------------

Marco Kesseler
Oce-Technologies B.V.
St. Urbanusweg 43, Venlo, The Netherlands
P.O. Box 101, 5900 MA Venlo, The Netherlands
telephone +31 77 359 5158
fax       +31 77 359 5450
e-mail    mke@oce.nl