~technomancy/fennel

Reintroduce ~= as an alias for not=. v1 PROPOSED

Phil Hagelberg: 1
 Reintroduce ~= as an alias for not=.

 2 files changed, 4 insertions(+), 5 deletions(-)
(Resending this to the list, sorry Phil for the duplicate message)

Phil Hagelberg <phil@hagelb.org> writes:
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~technomancy/fennel/patches/7821/mbox | git am -3
Learn more about email & git

[PATCH] Reintroduce ~= as an alias for not=. Export this patch

This makes it so that there are no breaking changes for 0.3.0 outside
the macro system, which is documented as being in flux.

Originally we removed ~= because we were going to make ~ a reserved
character in order to use it for unquote, like Clojure. But in the end
we decided to use commas for unquoting instead.
---
 changelog.md | 8 +++-----
 fennel.lua   | 1 +
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/changelog.md b/changelog.md
index e34b03e..fd0e1da 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,8 +2,8 @@

## 0.3.0 / ??

* **Disallow** non-gensym identifiers in backtick/macros.
* Support `x#` syntax for auto-gensym inside backtick.
* **Disallow** non-gensym identifiers in backtick/macros
* Support `x#` syntax for auto-gensym inside backtick
* Fix a bug in `lambda` arity checks when using destructuring
* Support `:one-line` output in fennelview
* Add `--eval` argument to command-line launcher
@@ -16,15 +16,13 @@
* Improve code generation for `if` expressions in many situations
* Alias `#` special with `length`
* Replace `@` (unquote) with `,`; comma is **no longer** whitespace
* **Disallow** `~` in symbols
* **Remove** `~=` special; use `not=` instead
* Add `hashfn` and `#` reader macro for shorthand functions like `#(+ $1 $2)`
* Add `macro` to make defining a single macro easier
* Add `(comment)` special which emits a Lua comment in the generated source

## 0.2.1 / 2019-01-22

* Add `not=` as an alias for `~=`
* Make `~=` into an alias for `not=`
* Fix a bug with `in-scope?` which caused `match` outer unification to fail
* Fix a bug with variadic `~=` comparisons
* Improve error reporting for mismatched delimiters
diff --git a/fennel.lua b/fennel.lua
index f68a38e..0013081 100644
--- a/fennel.lua
+++ b/fennel.lua
@@ -1719,6 +1719,7 @@ end
defineUnarySpecial('not', 'not ')
defineUnarySpecial('length', '#')
SPECIALS['#'] = SPECIALS['length']
SPECIALS['~='] = SPECIALS['not=']

-- Save current macro scope
local macroCurrentScope = GLOBAL_SCOPE
-- 
2.11.0
I guess really this is a question about whether we should treat the ~
character as reserved. If we want to do that, we should remove it from
the list in issymbolchar which allows it to be part of symbols, but if
we leave issymbolchar alone, then I think it would be better to
reintroduce this alias, because the original rationale for removing it
no longer applies.

Do we have any possible candidates for syntax that will require
reserving ~ for the future?

-Phil
View this thread in the archives