Point operator

From Esolang
Jump to navigation Jump to search

The point operator is an incredibly stupid (read: "New and eso") operator invented by User:Hppavilion1 in November of 2015 in an attempt to make floating point literals unnecessary for lexing for a new non-esolang he was working on. It was all well and good until Tanner Swett spoiled everything.

Idea

The point operator was to be a replacement for the standard token "3.5" (or similar-form number). Instead of simply detecting floats matching that syntax, the lexer would recognize two integers, along with a "." operator between them. The parser would join these (. would have very high precedence) into a single expression that the executioner would then convert to a float with an integer part of the left-hand side and a decimal part of the right-hand side.

Making . an operator would have allowed users to do things such as (x+y).5 or x.y or 0x3.5, which would have been useful in a few niche cases. The last one gets confusing, as the left-hand side is interpreted as a hex literal but the right-hand side is not, but it would've been cool. Alas, it was not to be. Fuckin' human notation.

Pitfall

To see the problem with the point operator, consider the expression 3.05. Since both sides are treated as integers, 3.05 is equivalent to 3.5, or truly any number of leading zeros for the decimal part are ignored. Tanner Swett came up with a few rather eso- solutions, such as making an infinite number of operators of the form {".", ".0", ".00", ".000"...}, but the language the author was attempting to develop was intended to be usable and rational while still channeling Hedwig Notta; not weird and insane in every way. Still, the . operator may live on into the language for making floating point values without leading zeros, if the author is feeling particularly strange that day.