~technomancy/fennel#173: 
Warning should be generated when expressions are passed to require with --require-as-include

Imagine compiling the following code with --require-as-include:

(require :literal)
(local variable :variable)
(require variable)

You get a warning about the :literal require, saying that it couldn't find the file on disk, and it is emitting an actual call to require in the output. However, you do not get a warning about variable, even though it is also a case where the file is not inlined.

$ fennel --require-as-include --compile example.fnl
-- WARNING: include module not found, falling back to require: "literal"
<output>

I think there should be a warning for both the variable and the literal, as they are both cases where the module can't be included.

Status
RESOLVED IMPLEMENTED
Submitter
~xerool
Assigned to
No-one
Submitted
11 months ago
Updated
14 days ago
Labels
needs-design

~andreyorst 11 months ago

I think there should be a warning for both the variable and the literal, as they are both cases where the module can't be included.

note that require-as-include allows for expressions that can be evaluated at compile-time, e.g. (require (.. ... ".foo")) so the fix should account for that

-- Andrey Listopadov

~technomancy 11 months ago

Hm... the problem is that I use this technique currently to deliberately disable the warnings for certain modules. =) So we can't just add the warning for this without having some way to suppress it for cases where you know it won't resolve.

~xerool 14 days ago

We have some way to suppress include warnings for cases where you know it won't resolve: --skip-include.

However, I think there's still a problem: you can't use --skip-include on an expression

~technomancy REPORTED IMPLEMENTED 14 days ago

Oh haha, of course. I think that's fine to make the bypass use a CLI flag. Fixed in d063d32.

Register here or Log in to comment, or comment via email.