bugKawa - Bugs: bug #11782, typed optional params not working?


bug #11782: typed optional params not working?

Submitted by:  Steve Yegge <stevey>
Submitted on:  Sat 29 Jan 2005 07:57:21 PM UTC  
Category: Scheme languageSeverity: 3 - Normal
Item Group: Compile-time exceptionStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Thu 24 Mar 2005 04:48:35 AM UTC, comment #1:

I do not believe this is a bug. While a suitable default initializer could be defined for various types, I think that is more complexity with little value.

I suggest supplying an initializer when specifying a typed optional parameter:

(define (foo #!optional (num :: <int> 0) )
(display num))

Jim White <jimwhite>
Sat 29 Jan 2005 07:57:21 PM UTC, original submission:

The docs say OPT-ARGs are bound to #f if not provided
and there's no initializer specified. This works properly
for untyped OPT-ARGS, but not if you specify a type.

(define (bar #!optional num)
(display num))


(bar 2)

(define (foo #!optional num :: <int>)
(display num))
<stdin>:87:1: warning - cannot convert literal (of type java.lang.Boolean) to

Invalid parameter, was: null
at atInteractiveLevel$29.foo(<stdin>)
at atInteractiveLevel$29.apply0(<stdin>:87)
at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:177)
at gnu.expr.ModuleMethod.apply(ModuleMethod.java:151)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:237)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:256)
at kawa.Shell.run(Shell.java:231)
at kawa.Shell.run(Shell.java:177)
at kawa.Shell.run(Shell.java:164)
at kawa.Shell.run(Shell.java:151)
at kawa.repl.main(repl.java:672)

(foo 2)

Steve Yegge <stevey>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.


Please enter the title of George Orwell's famous dystopian book (it's a date):



No Changes Have Been Made to This Item

Back to the top

Powered by Savane 3.1-cleanup