5 ms·
COBOL has a worse construct than this. ALTER LABEL1 TO PROCEED TO LABEL2 This will cause any gotos to LABEL1 to be redirected to LABEL2. This is worse than o
by tjalfi 7y ago
COBOL has a worse construct than this.
ALTER LABEL1 TO PROCEED TO LABEL2
This will cause any gotos to LABEL1 to be redirected to LABEL2.
This is worse than older Fortran's arithmetic IF[0].
[0] https://en.wikipedia.org/wiki/Arithmetic_IF https://en.wikipedia.org/wiki/Arithmetic_IF
- quickthrower2 7y agoMetaprogramming. Nice.
- Annatar 7y agoIt's self-modifying code, which is not the same thing as metaprogramming, which utilizes unexpanded expressions (often macros) which then get expanded in the final evaluation.
- vidarh 7y agoThe term meta programming in languages like Ruby and many others tends to be taken to include the language ability to dynamically alias (or create) methods at runtime. I don't think I can remember having seen it used to mean something as restrictive as you suggest
- jazzyjackson 7y agoI am much happier knowing this thank you
- raverbashing 7y agoHappy as in happy to never need to touch something like that
- jazzyjackson 7y agoYes it just fills me with appreciation for what I've taken for granted (although working in javascript of course any function can get redefined at any time so some things never change)
- shoo 7y agohttps://en.wikipedia.org/wiki/COMEFROM https://en.wikipedia.org/wiki/COMEFROM
- thaumasiotes 7y agoBut COMEFROM is a joke. Dynamic scope for goto labels is apparently real.
- jacobush 7y agoLooks good to me!
- nabla9 7y agoThat construct is very useful when the memory is measured in few kilowords and the call stack is tiny. Cobol was first used in computers that are equivalent to $1.5 PIC18 microcontrollers https://www.microchip.com/paramchartsearch/chart.aspx?branchID=1004 https://www.microchip.com/paramchartsearch/chart.aspx?branch...
- flippyhead 7y agoyeah, it's funny. This would be like car people (or pick any other group) in forums, pointing to some super popular car made 50 years ago and then making fun/light of all the crazy stuff the best engineers at the time felt was necessary.
- tjalfi 7y agoArithmetic IF and COBOL's ALTER statement were reasonable solutions at the time but that doesn't make them any easier to use or understand in the present.
- dmurray 7y agoThat arithmetic IF sounds really useful for the kind of numerical applications typically written in Fortran. Isn't it only bad because every other language uses IF as a boolean conditional?
- tjalfi 7y agoArithmetic IF directly matches a hardware instruction on the IBM 704. This was the first computer with a Fortran compiler. IF (VALUE) 10, 20, 30 The three arguments after the value are labels that the program jumps to. The equivalent of this line in C is something like this: if (value < 0) { goto 10; } else if (value == 0) { goto 20; } else { goto 30; } Fortran 77 added logical IFs that work like most other programing languages.
- euske 7y agoYou can do that (or worse) in C too. #define LABEL1 LABEL2 Is there any language that can be worse than a macro and #ifdef-ridden C? I'm only half joking.
- deleted 7y ago[deleted]
- TheSoftwareGuy 7y ago#define's are a compile time construct though. I think the parent is describing a statement that alters the runtime location of a label.
- Faark 7y agoYour C #define is done at compile time. This Cobol's alter example [1] seem to do so at runtime. Thus labels can be considered modifiable points. Actually, it's kinda interesting... does it support chains? Alter A->B and B->C, does GoTo A call C? If i now alter X->A then A->D and GoTo X, where do you end up? C? D? Hope you can at least undo that with something like alter A->A. Actually, I probably don't even want to know. Hope using it gives a big warning in whatever tools Cobal devs use. [1] https://riptutorial.com/cobol/example/19820/a-contrived-example-using-alter https://riptutorial.com/cobol/example/19820/a-contrived-exam...