﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
574	Define-constant cannot be used with the FFI	sjamaan	felix winkelmann	"I'm not 100% sure this is even a bug or just bad documentation/error messaging, but here goes:

If I compile the following ""program"", I get an error message:

{{{
#!scm
(define-constant one (foreign-value ""1"" int))
}}}

The error says

{{{
Syntax error: cannot evaluate compiler-special-form

        (##core#define-foreign-variable code_0 int ""1"")
}}}

I can see why; in compiler.scm, line 1111 under {{{##core#define-constant}}} it runs {{{eval}}} on the constant that's defined (unless it's a collapsible literal) but of course {{{eval}}} doesn't have access to compiler syntax, so it dies.

The question is - should this be an error or not?  It might make sense to just put the foreign value as-is in each usage point.

PS: there's a small spelling error in there, the predicate {{{collapsable-literal?}}} should be {{{collapsible-literal?}}} with an ""i"" instead of an ""a""."	defect	closed	minor	4.9.0	compiler	4.6.x	fixed	constants, ffi, foreign values		
