Opened 12 years ago

Last modified 7 months ago

#938 assigned enhancement

Feature Request: Load type files for units

Reported by: megane Owned by: felix winkelmann
Priority: minor Milestone: 6.0.0
Component: compiler Version: 4.8.x
Keywords: types units Cc:
Estimated difficulty: medium


Currently type files for units not installed in the repository are not loaded.

I've attached a patch that does something like this, but it's just a quick hack that works for my needs.

You should probably use ##sys#resolve-include-filename to find the types file, like it's used to find the inline files.

Attachments (2)

load-unit-type-files.patch (633 bytes) - added by megane 12 years ago.
a hack
search-for-types-files-from-include-paths.patch (703 bytes) - added by megane 11 years ago.
a better hack

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by megane

Attachment: load-unit-type-files.patch added

a hack

comment:1 Changed 12 years ago by felix winkelmann

Owner: set to felix winkelmann
Status: newassigned

Changed 11 years ago by megane

a better hack

comment:2 Changed 8 years ago by sjamaan

Milestone: someday5.1

Seems to be somehow related to the new unit/module handling in 5.0

comment:3 Changed 8 years ago by sjamaan

Estimated difficulty: medium

comment:4 Changed 6 years ago by megane

I think this issue was me confusing -I as an option to define additional paths CHICKEN should use to look for modules, when it's actually for the include form only.

CHICKEN only looks for modules in the egg repository and current directory. For modules in the current directory it does not automatically import .types or .inline files. You have to use -consult-types-file and -consult-inline-file for those, respectively.

Maybe the -I could be made to specify additional paths to consult modules from, if that makes sense.
I'm OK if this issue is closed as invalid, though.

The following shows that .types files are not automatically loaded.

$ ./
 (chicken-5 (import (chicken base))
            (import mod))
 (else (import chicken)
       (use mod)))

(print "--- main ---")
(compiler-typecase (foo 1)
  (symbol (print 'ok))
  (* (error "was not symbol")))
 (import scheme)
  (chicken-5 (import (chicken base) (chicken type)))
  (else (import chicken)))

 (: foo (* -> symbol))
 (define (foo x)
   (if (fixnum? x)
#!/usr/bin/env bash
set -e
set -o pipefail

more src/*.scm | cat

echo "### BUILD ###"
rm -rf build
mkdir -p build
cd build
csc -s -J -O3 -ot mod.types ../src/mod.scm -o
csc -O3 ../src/main.scm -o main

more *.import.scm *.types | cat


### BUILD ###
;;;; mod.import.scm - GENERATED BY CHICKEN 5.0.0rc4 -*- Scheme -*-

  '((foo . mod#foo))

; GENERATED BY CHICKEN 5.0.0rc4 FROM ../src/mod.scm

(mod#foo (#(procedure) mod#foo (*) symbol))

--- main ---

Error: was not symbol

	Call history:

	../src/main.scm:3: chicken.load#load-extension	  
	../src/main.scm:7: chicken.base#print	  
	../src/main.scm:8: mod#foo	  
	../src/main.scm:10: chicken.base#error	  	<--

comment:5 Changed 5 years ago by sjamaan

Milestone: 5.15.2

comment:6 Changed 5 years ago by felix winkelmann

Milestone: 5.25.3

comment:7 Changed 3 years ago by felix winkelmann

Milestone: 5.35.4

comment:8 Changed 7 months ago by felix winkelmann

Note: See TracTickets for help on using tickets.