The instruction g in Fish retrieves the character at a given position in the source code. The instruction causes the interpreter to crash under certain conditions.
Condition 1:Example code:30g
If you try to access a character outside of the source code area. According to the language spec, this should actually return a zero value. According to the spec, the codebox is "infinite in all directions", so even negative coordinates should be valid.
Condition 2:Example code:"A"f0pf1-0g
Using the instruction p, we can insert characters into the source code. When we insert a character far away from the existing source code, the gap in between is filled with spaces. Trying to access one of these spaces with g crashes the interpreter.
The instruction
g
in Fish retrieves the character at a given position in the source code. The instruction causes the interpreter to crash under certain conditions.Condition 1: Example code:
30g
If you try to access a character outside of the source code area. According to the language spec, this should actually return a zero value. According to the spec, the codebox is "infinite in all directions", so even negative coordinates should be valid.Condition 2: Example code:
"A"f0pf1-0g
Using the instructionp
, we can insert characters into the source code. When we insert a character far away from the existing source code, the gap in between is filled with spaces. Trying to access one of these spaces withg
crashes the interpreter.