|
Obscure programming language question |
|
monkeyson2 (16:07 13/11/2007) Phlamethrower (16:11 13/11/2007) alban (18:08 9/12/2007) glavallin (15:13 25/2/2013) MEmerton (09:50 28/2/2013) Stoppers (07:51 15/11/2007) Loris (14:22 19/11/2007) nunfetishist (20:29 20/11/2007) VincceH (21:21 20/11/2007) nunfetishist (15:49 21/11/2007) Loris (10:26 5/12/2007)
|
|
Phil Mellor |
Message #105246, posted by monkeyson2 at 16:07, 13/11/2007 |
Please don't let them make me be a monkey butler
Posts: 12380
|
I'm sure I remember reading about an odd feature of some programming language where you could write:
3 = x;
The constant 3 would be redefined as the current value of x.
Has anyone else heard of this or am I going nuts? |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #105248, posted by Phlamethrower at 16:11, 13/11/2007, in reply to message #105246 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
I think FORTH has an odd system like that where you can redefine stuff to be almost anything. But I can't be bothered checking while I'm at work |
|
[ Log in to reply ] |
|
Simon Willcocks |
Message #105274, posted by Stoppers at 07:51, 15/11/2007, in reply to message #105246 |
Member
Posts: 302
|
Another possibility would be smalltalk, where everything is an object, even classes. I've never used it, though, so there's a very good chance I'm wrong! |
|
[ Log in to reply ] |
|
Tony Haines |
Message #105325, posted by Loris at 14:22, 19/11/2007, in reply to message #105246 |
Ha ha, me mine, mwahahahaha
Posts: 1025
|
How would that work?
PI=3
X=2.5 3=X 2=4*3 Y=1+1 PRINT Y {reports 10?)
how would that apply to digits? 2=1 3=1 4=1 5=1 6=1 7=1 ... PRINT 234 {111?}
or how about 1=2 2=3 3=4 4=5 PRINT 1 {5, presumably?) |
|
[ Log in to reply ] |
|
Rob Kendrick |
Message #105354, posted by nunfetishist at 20:29, 20/11/2007, in reply to message #105246 |
Today's phish is trout a la creme.
Posts: 524
|
Some instances of FORTRAN allow you to do this. (Specifically, ones that aren't compiled.)
C, alas, forbids such excitement as #define 4 5 |
|
[ Log in to reply ] |
|
VinceH |
Message #105355, posted by VincceH at 21:21, 20/11/2007, in reply to message #105354 |
Lowering the tone since the dawn of time
Posts: 1600
|
C, alas, forbids such excitement as #define 4 5 Personally, I think what C does isn't forbid such excitement, but forbids such excrement. I can honestly see no sensible use for such things except as a method of obfuscation, and a route to code which is difficult to maintain. |
|
[ Log in to reply ] |
|
Rob Kendrick |
Message #105369, posted by nunfetishist at 15:49, 21/11/2007, in reply to message #105355 |
Today's phish is trout a la creme.
Posts: 524
|
What other purpose might it have? |
|
[ Log in to reply ] |
|
Tony Haines |
Message #105568, posted by Loris at 10:26, 5/12/2007, in reply to message #105369 |
Ha ha, me mine, mwahahahaha
Posts: 1025
|
What other purpose might it have? Make it easier to compute a circumference?
Some sort of high-speed exception/interrupt handling? |
|
[ Log in to reply ] |
|
alban |
Message #105608, posted by alban at 18:08, 9/12/2007, in reply to message #105248 |
Member
Posts: 2
|
You can certainly do this in WimpForth
: 3 6 ; ( redefine 3 as 6 )
3 2 + . 8 ok
I am not sure why you would want to do this though |
|
[ Log in to reply ] |
|
Geoff Lavallin |
Message #121952, posted by glavallin at 15:13, 25/2/2013, in reply to message #105608 |
Member
Posts: 44
|
You can certainly do this in WimpForth
: 3 6 ; ( redefine 3 as 6 )
3 2 + . 8 ok
I am not sure why you would want to do this though Looked for Iyonix version (2007) on http://www.leginda.com but could not find it. Is there an alternative address? |
|
[ Log in to reply ] |
|
Michael Emerton |
Message #121955, posted by MEmerton at 09:50, 28/2/2013, in reply to message #121952 |
Member
Posts: 75
|
I would be very interested in this, as my Dad programmed in Forth for many years from BBC to Archimedies to A7000+
It always seemed an easy language, with odd quirks (if you could get the hang of reverse polish notation: http://en.wikipedia.org/wiki/Reverse_Polish_notation |
|
[ Log in to reply ] |
|
|