Clojure

Evaling ((fn [do] do) 1) returns nil while ((fn [do] do do) 1) returns 1

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test

Description

user=> ((fn [do] do) 1)
nil

user=> ((fn [do] (do do)) 1)
1

user=> ((fn [] do))
nil

user=> ((fn [] do do))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(NO_SOURCE_PATH:0:0)

Activity

Hide
Nicola Mometto added a comment -

This patch creates a DoExpr class and makes DoExpr.Parser the DO special form parser.

DoExpr.Parser simply removes the 'do' symbol and delegates to BodyExpr, that was previously done by BodyExpr incorrectly.

Show
Nicola Mometto added a comment - This patch creates a DoExpr class and makes DoExpr.Parser the DO special form parser. DoExpr.Parser simply removes the 'do' symbol and delegates to BodyExpr, that was previously done by BodyExpr incorrectly.
Nicola Mometto made changes -
Field Original Value New Value
Attachment 0001-Create-a-DoExpr.Parser-class-that-delegates-to-BodyE.patch [ 12025 ]
Alex Miller made changes -
Labels compiler

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: