3 ms·
PortablE
- postexitus 1y agoI remember using Amiga E, from a cover disk of CU Amiga. Do I remember correctly that Amiga E had a "but" operator, which executes one statement but returns the value of the other? Never understood its point. I thought it was one of those things that put Amiga ahead of competitors (because other systems had C/D). Oh my teenager brain. Edit: looks like I remember correctly!: https://cshandley.co.uk/JasonHulance/beginner_93.html https://cshandley.co.uk/JasonHulance/beginner_93.html
- tialaramex 1y agoThat's some real esolang brain damage. Did somebody see the (four!) needlessly confusing increment and decrement operators in C and think this hadn't gone far enough? It's not quite COME FROM but it sure is close for a supposedly useful language.
- amiga386 1y agoIt's only doing what the https://en.wikipedia.org/wiki/Comma_operator https://en.wikipedia.org/wiki/Comma_operator does in C Why you'd use it? Probably for reducing statements to expressions, e.g. PROC lower_delta(a1,a2,b1,b2) IS (da:=a2-a1) BUT (db:=b2-b1) BUT (IF da<db THEN da ELSE db)
- tialaramex 1y agoThat's just "I wish this was an expression language". Yeah, good idea, why isn't it? type Num = i32; // Or whatever your preferred numeric type is fn lower_delta(a1: Num, a2: Num, b1: Num, b2: Num) -> Num { let da = a2 - a1; let db = b2 - b1; if da < db { da } else { db } }
- amiga386 1y agoA more useful example I found: REPEAT ... UNTIL CtrlC() OR (IF m:=GetMsg(wnd.userport) THEN ReplyMsg(m) BUT 1 ELSE 0) Which means loop until Ctrl-C is pressed, or an IDCMP message comes to the window (which must be replied to allow the sender to reuse/free the message, but otherwise we don't care what's in the message, because we know it's either a keypress or a mouseclick, and both end the loop). The comma operator, or "BUT", lets us capture the result of GetMsg(), go down a positive "we got a message so end the loop" path, but also fits in a ReplyMsg() so we don't have to deal with it anywhere else
- tialaramex 1y agoLike I said though, you wanted an expression language, just have an expression language loop { // ... if ctrl_c() || match get_msg(wnd.userport) { None => false, Some(m) => { _ = reply_msg(m); true } } { break; } }