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


bug #11782: typed optional params not working?

Submitter:  Steve Yegge <stevey>
Submitted:  Sat 29 Jan 2005 07:57:21 PM UTC
Category:  Scheme language Severity:  3 - Normal
Item Group:  Compile-time exception Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:
       No canned response available


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 Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.





No changes have been made to this item

Back to the top

Powered by Savane 3.9