Opened 2 years ago

Closed 2 years ago

#1806 closed enhancement (wontfix)

Finding missing dependencies

Reported by: Idiomdrottning Owned by:
Priority: minor Milestone: someday
Component: compiler Version: 5.3.0
Keywords: Cc:
Estimated difficulty:

Description

So I forgot to add a dependency (brev-separate) and csc didn't find it, which is fair enough, it's on me.

But Teiresias pointed out that if I had jammed it into a module, csc would've found it:

Part of the magic of csc flagging errors for you lies in modules.  The
following would also have caught the missing dep when compiled by csc:

;; © 2022 Idiomdrottning, BSD 1-Clause License

(module main ()
(import fmt fmt-c tree)

(fmt #t
     (c-expr
      (tree-map
       (fn
	(case x ((fun) '%fun) ((var) '%var)
	      ((pointer) '%pointer) ((array) '%array)
	      ((cast) '%cast) (else x)))
       (read))))
)

So probably best to (module) everything as a matter of course.

(As in, he only added the (module main () …) wrapper and that made csc able to find the missing deps.)
Sure. Only problem with that is that I don't wanna. Can't CSC apply the same magic even when there's no explicit module? Implicit is better than explicit.

Change History (1)

comment:1 Changed 2 years ago by sjamaan

Resolution: wontfix
Status: newclosed

One problem with that is that the toplevel can be extended with eval or load, so the procedure could be left undefined and then defined by (say) loading a configuration file.

Another problem is that you can link multiple "compilation units" together. So with a.scm containing the import and b.scm containing the rest of the code, you could compile them separately and link them together after which it will work.

Modules, on the other hand, have to be fully resolved.

With csc you can always use the -m switch to wrap your code in a module, even if the code itself doesn't have a module.

Note: See TracTickets for help on using tickets.