~benaiah

Recent activity

[PATCH] Only replace _trailing_ "elseif true" with "else" 19 days ago

From Benaiah Mischenko to ~technomancy/fennel

---
 fennel.lua | 4 +++-
 test.lua   | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fennel.lua b/fennel.lua
index c5e451b..1f3bbe7 100644
--- a/fennel.lua
+++ b/fennel.lua
@@ -1493,7 +1493,9 @@ SPECIALS['if'] = function(ast, scope, parent, opts)
         local branch = branches[i]
         local fstr = not branch.nested and 'if %s then' or 'elseif %s then'
         local cond = tostring(branch.cond)
-        local condLine = (cond == "true" and branch.nested) and "else" or fstr:format(cond)
[message trimmed]

[PATCH v2] Make hashfn arguments work when beginning multisyms 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

Converts $ arguments to $1 when they begin a multisym (matches the
behavior of a lone $).

Sets used-local metadata correctly for symbols which begin
multisyms. This was previously incorrect for all symbols which started
multisyms, but the hashfn argument bug fixed in this commit is the
only known effect.

Added test cases for multisyms and immediately-returned arguments to
ensure neither regress.

Enables a getter function shorthand: #$symbol.property

---
[message trimmed]

[PATCH v2] Emit "else" instead of "elseif true then" 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

---
Fixes the last patch version's bad code caused by replacing "if true"
with "else"

 fennel.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fennel.lua b/fennel.lua
index b07b47e..e5d18e6 100644
--- a/fennel.lua
+++ b/fennel.lua
@@ -1483,7 +1483,8 @@ SPECIALS['if'] = function(ast, scope, parent, opts)
     for i = 1, #branches do
         local branch = branches[i]
[message trimmed]

Re: [PATCH] Emit "else" instead of "elseif true then" 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

> This one's actually causing some test failures; can you take another look?

Whoops, should have remembered to run the tests before I submitted the
patch. It was replacing every "if true then" to "else" as well, which
obviously doesn't work in lua. Thanks for catching this - submitting a
fixed and rebased patch now.

- benaiah

[PATCH] Include all tests in the "passed tests" count 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

---
 test.lua | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test.lua b/test.lua
index 2c627c3..6c75cba 100644
--- a/test.lua
+++ b/test.lua
@@ -520,6 +520,8 @@ for code, expected_msg in pairs(compile_failures) do
         fail = fail + 1
         print(" Expected " .. expected_msg .. " when compiling " .. code ..
                   " but got " .. msg)
+    else
+        pass = pass + 1
[message trimmed]

[PATCH] Emit "else" instead of "elseif true then" 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

---

 fennel.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fennel.lua b/fennel.lua
index f68a38e..b1744a8 100644
--- a/fennel.lua
+++ b/fennel.lua
@@ -1448,7 +1448,8 @@ SPECIALS['if'] = function(ast, scope, parent, opts)
     for i = 1, #branches do
         local branch = branches[i]
         local fstr = not branch.nested and 'if %s then' or 'elseif %s then'
-        local condLine = fstr:format(tostring(branch.cond))
[message trimmed]

[PATCH] Make hashfn arguments work when beginning multisyms 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

Converts $ arguments to $1 when they begin a multisym (matches the
behavior of a lone $).

Sets used-local metadata correctly for symbols which begin
multisyms. This was previously incorrect for all symbols which started
multisyms, but the hashfn argument bug fixed in this commit is the
only known effect.

Added test cases for multisyms and immediately-returned arguments to
ensure neither regress.

Enables a getter function shorthand: #$symbol.property
---
This version of the patch adds a changelog entry and expands the
[message trimmed]

Re: [PATCH] Enable lua style method calls 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

I've attached the patch instead of using git send-email; maybe it will
thread better?

Phil Hagelberg <phil@hagelb.org> writes:

> I think the rules about what constitutes a valid symbol or multisymbol
> should be enforced during parsing rather than in the ismultisym
> function; that way the errors will have line numbers. You can see how I
> enforced multisym rules here:
>
>     https://github.com/bakpakin/Fennel/commit/2f43f19797838772061e3a0e2563b51269189f2b
>
> In general, using `error' or `assert' directly in the compiler is best
> avoided; instead either use `parseError' or `assertCompile' which will

Re: [PATCH] Reintroduce ~= as an alias for not=. 21 days ago

From Benaiah Mischenko to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

> Benaiah Mischenko <benaiah@mischenko.com> writes:
>
>> Phil Hagelberg <phil@hagelb.org> writes:
>>
>>> I just realized that the list in issymbolchar is a *disallowed* list,
>>> not a list of allowed chars. So ~ is already intended to be blocked, but
>>> it's not blocked consistently, since ~= is allowed to be used.
>>
>> o.O this definitely does not seem like intended behavior.
>
> The first patch contains a small fix for this; disallowed symbols are
> now disallowed consistently instead of being allowed as the first char

Re: [PATCH] Reintroduce ~= as an alias for not=. 23 days ago

From Benaiah Mischenko to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

> I just realized that the list in issymbolchar is a *disallowed* list,
> not a list of allowed chars. So ~ is already intended to be blocked, but
> it's not blocked consistently, since ~= is allowed to be used. Also this
> fails to compile:
>
>     (let [a~ 1] a~)
>
> But this succeeds:
>
>     (let [~a 1] ~a)

o.O this definitely does not seem like intended behavior.