This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

new warnings for keywords


The plan is for the syntax for using keywords in Kawa Scheme to be stricter.
I just checked in some warnings; these may switch to errors later.

First, if you want a literal keyword value, you should quote it;
otherwise you will get a warning.

Secondly, only literal unquoted keywords are recognized before keyword arguments
in function calls.  The compiler warns if a literal non-quoted keyword is not
followed by an expression (i.e. something that is not a literal unquoted keyword).
Also, all the keyword-value pairs must be adjacent.  The following are warned about:
  (f x: y: 2)
  (f x: 2 y:)
  (f x: 2 3 y: 4)

For now, this is only partially enforced at rewrite time.  The following is
allowed for now, but will be disallowed in the future:
  (list 1 a: 2 b: 3) ;; bad - instead write: (list 1 'a: 2 'b: 3)

I'm working on a new calling convention (which will support pattern matching ...).
Keyword parameters will only match explicit literal keywords, not expressions that
*happen* to evaluate to keywords.  This can allow better performance, and avoids
errors and accidental matches.

Consider Kawa's general object-allocation syntax:
http://www.gnu.org/software/kawa/Allocating-objects.html
Kawa really needs to know which sub-expressions are keywords, and
which are values.  Currently Kawa decides that a sub-expression is a "keyword"
if it's a QuoteExp whose value is a KeyWord.  This is fragile - if an expression
evaluates to a Keyword, it may behave differently if inlined by the compiler,
and otherwise.

To handle apply-style applications, there will be an "arglist" type, which is like a
list (or vector) but you

This change btw is similar to how Racket handles keywords.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]