* [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
@ 2016-05-13 21:01 aditya siram
2016-05-14 1:08 ` Alexis
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: aditya siram @ 2016-05-13 21:01 UTC (permalink / raw
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]
Hi all,
I'm happy to announce a port of the Shen programming language [1] to Elisp
[2]. This means that all Shen programs can be run directly from Emacs
without any other dependencies. It is available for immediate installation
via Melpa [3].
However I could use some help with a couple of issues with packaging and
warnings generated by the byte-compiler:
1. I can't seem to get rid of warnings when byte-compiling the generated
"shen.el" [4] even though I have the byte-compile-warnings property the top
of the file. I'm getting a lot of "unused lexical variable" warnings even
though "lexical" is in the list of warnings.
2. I would like for the "shen.el" and "shen-primitives.el" [5] file to be
byte-compiled and loaded right after compilation even though they don't
have any autoloads. Currently they are only loaded with I call the function
`shen/repl` [6] which doesn't feel very responsive. Ideally they are loaded
at the time they are compiled.
Thanks!
-deech
[1] http://shenlanguage.org
[2] http://github.com/deech/shen-elisp
[3] https://melpa.org/#/shen-elisp
[4] https://raw.githubusercontent.com/deech/shen-elisp/master/shen.el
[5]
https://raw.githubusercontent.com/deech/shen-elisp/master/shen-primitives.el
[6] https://github.com/deech/shen-elisp/blob/master/shen-repl.el#L221
[-- Attachment #2: Type: text/html, Size: 1823 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
2016-05-13 21:01 [Ann]: An Implementation of the Shen programming language in Elisp and a call for help aditya siram
@ 2016-05-14 1:08 ` Alexis
2016-05-14 1:11 ` aditya siram
2016-05-14 1:41 ` Michael Heerdegen
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Alexis @ 2016-05-14 1:08 UTC (permalink / raw
To: aditya siram; +Cc: emacs-devel
aditya siram <aditya.siram@gmail.com> writes:
> 1. I can't seem to get rid of warnings when byte-compiling the
> generated "shen.el" [4] even though I have the
> byte-compile-warnings property the top of the file. I'm getting
> a lot of "unused lexical variable" warnings even though
> "lexical" is in the list of warnings.
Well, it seems you're not making use of the lexical variables you
define. For example:
(shen/let NewHistory
(shen/shen\.update_history NewLineread History)
(shen/let Parsed
(shen/fst NewLineread)
(shen/shen\.toplevel Parsed)))))))
Here you create the `NewHistory' variable, but don't make use of
it within the scope of the `shen-let'.
Similarly, there are things like:
(shen/let Record
(shen/shen\.record-source V13163 KL) KL))))
where `Record` is not used within the relevant scope, and:
(shen/let NewVector
(shen/vector
(shen/- Limit 1))
(shen/shen\.tlv-help V14674 2 Limit
(shen/vector (shen/- Limit
1))))))))
where `NewVector' is not used within the relevant scope, and so
on.
So, why are you binding variables you don't make any use of after
the initial binding?
Alexis.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
2016-05-14 1:08 ` Alexis
@ 2016-05-14 1:11 ` aditya siram
2016-05-14 1:30 ` Alexis
0 siblings, 1 reply; 7+ messages in thread
From: aditya siram @ 2016-05-14 1:11 UTC (permalink / raw
To: Alexis; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]
Hi,
Thanks for taking the time to reply. This is generated code so I have less
control over what is used. I thought disabling the warning up top would
take care of it.
-deech
On Fri, May 13, 2016 at 8:08 PM, Alexis <flexibeast@gmail.com> wrote:
>
> aditya siram <aditya.siram@gmail.com> writes:
>
> 1. I can't seem to get rid of warnings when byte-compiling the generated
>> "shen.el" [4] even though I have the byte-compile-warnings property the top
>> of the file. I'm getting a lot of "unused lexical variable" warnings even
>> though "lexical" is in the list of warnings.
>>
>
> Well, it seems you're not making use of the lexical variables you define.
> For example:
>
> (shen/let NewHistory (shen/shen\.update_history
> NewLineread History) (shen/let Parsed
> (shen/fst NewLineread) (shen/shen\.toplevel
> Parsed)))))))
>
> Here you create the `NewHistory' variable, but don't make use of it within
> the scope of the `shen-let'.
>
> Similarly, there are things like:
>
> (shen/let Record (shen/shen\.record-source V13163 KL)
> KL))))
>
> where `Record` is not used within the relevant scope, and:
>
> (shen/let NewVector (shen/vector (shen/-
> Limit 1)) (shen/shen\.tlv-help V14674 2 Limit
> (shen/vector (shen/- Limit
> 1))))))))
>
> where `NewVector' is not used within the relevant scope, and so on.
>
> So, why are you binding variables you don't make any use of after the
> initial binding?
>
> Alexis.
>
[-- Attachment #2: Type: text/html, Size: 2434 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
2016-05-14 1:11 ` aditya siram
@ 2016-05-14 1:30 ` Alexis
0 siblings, 0 replies; 7+ messages in thread
From: Alexis @ 2016-05-14 1:30 UTC (permalink / raw
To: aditya siram; +Cc: emacs-devel
aditya siram <aditya.siram@gmail.com> writes:
> Thanks for taking the time to reply. This is generated code so I
> have less control over what is used.
Hm, okay.
> I thought disabling the warning up top would take care of it.
At least on 24.5, the documentation for `byte-compile-warnings'
says:
Elements of the list may be:
[snip] lexical global/dynamic variables lacking a
prefix.
which i interpret as being about variable naming, rather than
variable use.
Alexis.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
2016-05-13 21:01 [Ann]: An Implementation of the Shen programming language in Elisp and a call for help aditya siram
2016-05-14 1:08 ` Alexis
@ 2016-05-14 1:41 ` Michael Heerdegen
2016-05-14 13:29 ` Stefan Monnier
2016-05-16 17:54 ` Stefan Monnier
3 siblings, 0 replies; 7+ messages in thread
From: Michael Heerdegen @ 2016-05-14 1:41 UTC (permalink / raw
To: emacs-devel
aditya siram <aditya.siram@gmail.com> writes:
> 1. I can't seem to get rid of warnings when byte-compiling the
> generated "shen.el" [4] even though I have the byte-compile-warnings
> property the top of the file. I'm getting a lot of "unused lexical
> variable" warnings even though "lexical" is in the list of warnings.
Hmm, the doc of `byte-compile-warnings' says:
lexical global/dynamic variables lacking a prefix.
So this flag apparently doesn't mean what you think (what probably most
people think...)
I'm not sure if it's possible to get rid of these warnings at all.
Michael.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
2016-05-13 21:01 [Ann]: An Implementation of the Shen programming language in Elisp and a call for help aditya siram
2016-05-14 1:08 ` Alexis
2016-05-14 1:41 ` Michael Heerdegen
@ 2016-05-14 13:29 ` Stefan Monnier
2016-05-16 17:54 ` Stefan Monnier
3 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-05-14 13:29 UTC (permalink / raw
To: emacs-devel
> 1. I can't seem to get rid of warnings when byte-compiling the generated
> "shen.el" [4] even though I have the byte-compile-warnings property the top
> of the file. I'm getting a lot of "unused lexical variable" warnings even
> though "lexical" is in the list of warnings.
I strongly dislike disabling warnings via byte-compile-warnings, so
while I'm sure it can be done, I'd rather not help you with this.
"Unused variable/argument" warnings can be disabled individually in the
following ways (by order of preference):
- Get rid of those variables/arguments.
- Add an underscore in front of the variable name (that tells the
byte-compiler that the variable *should not* be used).
- Add an artificial use of the variable. The canonical way to do that
is to add a call (ignore <var>) somewhere harmless. E.g.
(let ((foo <mycode>))
(ignore foo)
<restofthecode>)
> 2. I would like for the "shen.el" and "shen-primitives.el" [5] file to be
> byte-compiled and loaded right after compilation even though they don't
> have any autoloads. Currently they are only loaded with I call the function
> `shen/repl` [6] which doesn't feel very responsive. Ideally they are loaded
> at the time they are compiled.
Compilation should happen once and for all when you install your
package, so whether it's loaded right away at that point or not is not
tremendously important, compared to how the package should be
(auto)loaded in the other cases, when the package is already installed.
IOW I don't understand what you want here.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Ann]: An Implementation of the Shen programming language in Elisp and a call for help
2016-05-13 21:01 [Ann]: An Implementation of the Shen programming language in Elisp and a call for help aditya siram
` (2 preceding siblings ...)
2016-05-14 13:29 ` Stefan Monnier
@ 2016-05-16 17:54 ` Stefan Monnier
3 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-05-16 17:54 UTC (permalink / raw
To: emacs-devel
[ I thought I had sent a reply but I can't see it, so here's another one. ]
> However I could use some help with a couple of issues with packaging and
> warnings generated by the byte-compiler:
> 1. I can't seem to get rid of warnings when byte-compiling the generated
> "shen.el" [4] even though I have the byte-compile-warnings property the top
> of the file. I'm getting a lot of "unused lexical variable" warnings even
> though "lexical" is in the list of warnings.
I recommend you don't touch byte-compile-warnings. Instead, handle each
warning individually. For "unused var" warnings, you have various options
(by order of preference):
1- Get rid of the variable.
2- Add an underscore at the beginning of the var's name. This tells the
compiler that this variable *should* not be used.
3- Add an artificial use of the var. Typically a call to `ignore', as in:
(defun toto (arg1)
(let ((var2 val))
(ignore arg1 var2)
...))
This is usually the best way to deal with non-hygienic vars
introduced in macros where we can't tell if the macro's expansion
will or will not make use of the variable.
4- Add a (defvar <thevar>) to indicate the variable should use dynamic scoping.
> 2. I would like for the "shen.el" and "shen-primitives.el" [5] file to be
> byte-compiled and loaded right after compilation even though they don't
> have any autoloads. Currently they are only loaded with I call the function
> `shen/repl` [6] which doesn't feel very responsive. Ideally they are loaded
> at the time they are compiled.
I don't understand, sorry: in my context, compilation takes place once and
for all when you install the package, so loading it at that time wouldn't
help all the other times when I use the package without first
byte-compiling it (because it's already byte-compiled).
Could you explain in more details what's your use-case or scenario?
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-16 17:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-13 21:01 [Ann]: An Implementation of the Shen programming language in Elisp and a call for help aditya siram
2016-05-14 1:08 ` Alexis
2016-05-14 1:11 ` aditya siram
2016-05-14 1:30 ` Alexis
2016-05-14 1:41 ` Michael Heerdegen
2016-05-14 13:29 ` Stefan Monnier
2016-05-16 17:54 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.