[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Re: Towards SC 4

Dear List (& Miguel),

This is all a little off-topic here, so very briefly.

I'm afraid I can't help about non-Emacs editors.

About types & references though:

Haskell does has various forms of mutable references.

The notation is different, but the type constraints are
the same as those in sclanguage.

In sclanguage, if you change the latent type of a value
bound to a reference you will get an error when you try
to use the value.

f = 5;
g = {|n| f - n};
g.(4) == 1;
f = "5";
g.(4); /* ==> error */

In haskell the interpreter won't let you write a type
incoherent value to a reference.

It's more or less the "same difference"?

The error arrives one step earlier.

f <- newIORef (5::Integer)
let g n = fmap (subtract n) (readIORef f)
fmap (== 1) (g 4)
writeIORef f "5" {- ==> error -}

But mutable references are like heterogenous sequences,
rather esoteric & only very rarely necessary!


sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/