Open harendra-kumar opened 2 years ago
Some common mistakes that can be caught:
What one generally wants to do:
x = "Something " ++ here
What one might end up doing:
x = "Something #{here}"
x = [str|"Something #{here}"
|]Not using str
or additional usage of quotes should result in some warnings.
Another common mistake,
[str|Something ${here}|]
#
and $
are very close to each other.
I use the following in emacs for an easier visual representation,
(highlight-regexp "#{[a-zA-Z0-9_]*}" 'hi-red-b)
(highlight-regexp "\\[str|" 'hi-green-b)
(highlight-regexp "|\\]" 'hi-green-b)
This would highlight
[|str
and |]
in bold green.#{..}
in bold red.
Unterminated interpolation is not detected and reported:
The above leads to a run time error:
Instead we should report an error ar compile time.