~andreyorst

Moscow

https://andreyorst.gitlab.io/

I love Lisp and text editors!

Recent activity

[PATCH fennel v2] fix https://todo.sr.ht/~technomancy/fennel/125 6 hours ago

From Andrey Listopadov to ~technomancy/fennel

This walks each expression and check if there are any literal
nils. These nils are then converted to quoted nils to preserve list
length.
---
 changelog.md            |  3 +++
 src/fennel/compiler.fnl | 23 ++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/changelog.md b/changelog.md
index db7ac77..5d9477b 100644
--- a/changelog.md
+++ b/changelog.md
@@ -23,6 +23,9 @@ deprecated forms.
* Improve argument handling so unused arguments get passed on to script
[message trimmed]

[PATCH fennel] fix https://todo.sr.ht/~technomancy/fennel/125 18 hours ago

From Andrey Listopadov to ~technomancy/fennel

This walks each expression and check if there are any literal
nils. These nils are then converted to quoted nils to preserve list
length.
---
 changelog.md            |  3 +++
 src/fennel/compiler.fnl | 23 ++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/changelog.md b/changelog.md
index db7ac77..5d9477b 100644
--- a/changelog.md
+++ b/changelog.md
@@ -23,6 +23,9 @@ deprecated forms.
* Improve argument handling so unused arguments get passed on to script
[message trimmed]

Re: Library writing anoyyances a day ago

From Andrey Listopadov to ~technomancy/fennel

>> - Its next to impossible to redistribute other libraries' macros.
>
> Is it difficult if both are full macro-modules, or is this only a
> problem for macros introduced with the `macros` form? It seems like in a
> macro module, you should just be able to require the other module like a
> normal module and grab its functions to export from your own
> module. Can you describe what it is specifically which prevents this
> from working?

If the library uses the relative require set up, it makes it a lot
harder, because now you have to make relative require of a relative
require work, and it's a real mess. As it appears to me current
practices doesn't work for this kind of setup.

Library writing anoyyances a day ago

From Andrey Listopadov to ~technomancy/fennel

Hello everyone! I'm in a writing mood today, so I've decided to send a
message.


I've spent last 1.5 years writing various libraries for Fennel, ones
like cljlib[1], lazy-seq[2], fennel-conditions[3], fennel-test[4], and
others.  I've listed these in particular, because they share some common
annoyances when it comes at distributing libraries, or even just using
libraries in other projects.

Fennel doesn't have its own package manager, and luarocks is not the
best one, so I chose not to use it, and basically ship my libraries
either as a single-file dependency when possible, or as a directory with

Re: Named scopes, switching module scope in REPL, finer completion 20 days ago

From Andrey Listopadov to ~technomancy/fennel

I think this will require a bit more refactoring than we've initially thought.
The metadata is now global as far as I can tell, e.g. if you create a
function foo with some docstring, and then create another function foo
in another module, the only way to refer to both docstrings is by having
these functions be fully qualified, e.g. ,doc mod1.foo and ,doc mod2.foo

However, if we're going to provide module-locals to completion, we'll
also need to provide module-local metadata for the items in this
module.  Otherwise, things like fennel-mode will query completions from
one source, and documentation from another, making the two
desynchronize, because symbols are not fully qualified when 
entering/editing a module.

Re: Named scopes, switching module scope in REPL, finer completion 22 days ago

From Andrey Listopadov to ~technomancy/fennel

Here's a very quick prototype to make sure we're on the same page,
regarding runtime part. I've made these macros that act as local, var,
global, and fn, and what they essentially d is expand to
(local name (let [sym_1_ value] ... sym_1_) where ... is some
compile-time generated code to put name and value to the
___moduleLocals___ table.

For now, these macros accept the module name, as it is a quick
prototype, but I think we can adopt this kind of technology for main
use in the fennel compiler. Here's the code:

(fn prep [mod]
  "Common prep step for creating module binding table."
  `(do

Re: Named scopes, switching module scope in REPL, finer completion 22 days ago

From Andrey Listopadov to ~technomancy/fennel

>IMO we should avoid using the word scope for the runtime
>feature. Perhaps just calling it "module locals" for the feature which
>exposes the data, and ",enter" for the repl command?

Sounds good to me! I'll se what can be done for creating
module-locals thing.

Re: Named scopes, switching module scope in REPL, finer completion 25 days ago

From Andrey Listopadov to ~technomancy/fennel

> I was thinking that we would need to make sure that the table format we
> use would be extensible enough that we could add more targeted
> per-position data later on. But thinking about it more, I think the
> targeted scope info should be queried by making a fresh compile every
> time, as a function call rather than a table lookup. So it doesn't have
> to use the same table.

That's a neat idea! Although I think we're talking about different
features :D I'll try to explain in a bit more details below what I've
envisioned.

>> OTOH, {:locals {:local-name {:value the-value :fn-args [names]}}} can be
>> used instead, which also easy to extend with newer info, and editor can

Re: Named scopes, switching module scope in REPL, finer completion 26 days ago

From Andrey Listopadov to ~technomancy/fennel

> So one question is whether this should be a top-level thing or an
> arbitrarily-positioned thing. For instance, if you want completion
> candidates in your editor, and you are inside a function, the completion
> candidates should ideally include the arguments to the function. But the
> implementation of very finely-targeted scopes tables would be very
> different from what you would get with only one scope table per module.

I think we can start with something small and simple, and build from it.
For example, when we (re)load a module, we can create a table entry,
like:

{:module-name {:locals {:local-name :the-value}}

Named scopes, switching module scope in REPL, finer completion 29 days ago

From Andrey Listopadov to ~technomancy/fennel

During the fennel user group meeting we had a discussion about scopes,
and the problem of highlighting macros, and providing finer completions
in the editor, and came up with an idea of how this could be improved.

Right now we have the REPL scope, which is used for everything, and only
things that are available in the REPL scope are available for the
editor.  So if you're using the reload-based workflow, and keep your
state and definitions in the file, you don't have any completion
candidates, besides the ones you've manually sent to the REPL.

In order to solve this problem, I've suggested extending the scope table
into a table of scope tables, each of which is associated with the name
used to reload the module.  This way, the scope table can be updated
upon reload, and also can be queried for completion. For example, for a