Ticket #107 (assigned enhancement)

Opened 8 years ago

Last modified 7 years ago

Definition order should not be important in where block

Reported by: erikd Owned by: steggles
Priority: project Milestone: _|_
Component: Source Semantics Version: 0.1.2
Keywords: Cc:


Two almost identical functions below. The first parses successfully, the second fails.

compileSuccess :: Int -> Int
compileSuccess x =
	x + y
    -- This works becuase 'z' is defined before it is used.
    z = 4
    y = 3 + z

compileFail :: Int -> Int
compileFail x =
	x + y
    -- Using 'z' before it is defined fails.
    y = 3 + z
    z = 4

Change History

Changed 8 years ago by benl

  • priority changed from normal to project
  • version set to 0.1.2
  • component changed from Unknown to Source Parser
  • milestone set to _|_

This is only true if the expressions that are out of order don't have conflicting effects. There are also problems if one of them diverges.

For a language that uses call-by-value evaluation as default, we should probably require non-function bindings to be in the correct order. We could reasonably allow function bindings to be out of order, but I'm not sure we want to make this a special case.

Changed 8 years ago by benl

  • type changed from defect to enhancement
  • component changed from Source Parser to Source Semantics

Changed 7 years ago by steggles

  • owner set to steggles
  • status changed from new to assigned
Note: See TracTickets for help on using tickets.