On Wed, 2003-10-22 at 10:54, Louis Kruger wrote:
> This problem seems like another example of why Unicon could benefit from
> references types. (seems like there have been a lot of these examples
> recently)
Careful! Icon and Unicon have gotten along pretty well for years
without reference types. While I think it deserves more discussion,
it's not clear that most of the examples aren't self-fulfilling -
there may well be equally clean ways of addressing the same issues
using other approaches. Also note, as Clint said, that there are
any number of functional languages that are also successful w/o
reference types.
>
> Any suggestions for what actual syntax is possible for this?
Perhaps the semantics should be discussed.
What should the behavior of the following be (also ignoring syntax
issues):
global xref
procedure f(a)
xref := &a
a := 3
end
...
write(*xref)
and
procedure g()
yref := &xref
*yref := &yref
write(*xref)
end
There are reasons why functional languages don't like reference
types - they can be addressed, but it needs careful thought.
Languages like C and FORTRAN operate under a 'caveat emptor'
philosophy that isn't appropriate for languages like Unicon.
[As an aside, back when I started teaching, I told my FORTRAN
class not to worry about breaking the computer, they couldn't
hurt it (at that time it was a multi-million dollar mainframe
used on campus for class *and* administrative work).
Well, several month later the computer center starts getting
unexpected power shutdowns on the computer - it would detect
a power failure and quickly enter a failsafe mode before
shutting itself off. They tried everything - adding a fly-wheel
generator, monitoring the power-line, etc.
Then one day one of my students came to my office and said
"I know it sounds crazy, but every time I run my homework
assignment the computer crashes." Turns out he was passing
the constant 30 to a function that was expecting a function
reference as that argument. So the mainframe was merrily
executing a subroutine call to address 30 - which happened
to the start of the interrupt handler for power failure...]
These days, with separate kernel and user spaces this probably
wouldn't be possible, but it was certainly embarassing at
the time!]
--
Steve Wampler -- [EMAIL PROTECTED]
Quantum materiae materietur marmota monax si marmota
monax materiam possit materiari?
-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group