Ticket #1910 (assigned enhancement)

Opened 4 years ago

Last modified 2 years ago

defbuiltin optional arg default values don't get eval'd

Reported by: anonymous Assigned to: tim (accepted)
Priority: low Milestone: 3.1.0 beta
Component: Generator Version: trunk
Severity: minor Keywords:
Cc:

Description (Last modified by weyrick)

Given a php-builtin defined like this:

(define *scheme-var* 10)
(defbuiltin (some-builtin (opt-arg1 *scheme-var*))
   opt-arg1))

The following PHP script:

<?php echo some-builtin()."\n"; ?>

produces the _string_:

*scheme-var*

because the default value gets quoted before being evaluated and then when it eventually gets evaluated, it evaluates to the symbol *scheme-var* and not the value of *scheme-var*. 


ADDITIONAL INFORMATION:
changing compiler/generate.scm line 947 from:

,(let ((default (optional-formal-param-default-value p)))

to:
	  
,(let ((default (eval (optional-formal-param-default-value p))))

fixes the problem and doesn't break anything else.

Also, changing line 1552 (or so) in php-runtime.scm from:

((quote ?FOO) FOO)

to:

((quote ?FOO) (eval FOO))

did not fix the problem.

Change History

01/24/06 04:48:03 changed by weyrick

still relavent?

04/15/07 11:44:08 changed by weyrick

  • severity changed from tweak to minor.
  • version set to trunk.
  • type set to enhancement.
  • description changed.
  • milestone set to 3.1.0 beta.