Opened 10 years ago

Closed 6 years ago

#107 closed enhancement (wontfix)

Definition order should not be important in where block

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

Description (last modified by benl)

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

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

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

Change History (7)

comment:1 Changed 10 years ago by benl

  • Component changed from Unknown to Source Parser
  • Milestone set to _|_
  • Priority changed from normal to project
  • Version set to 0.1.2

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.

comment:2 Changed 10 years ago by benl

  • Component changed from Source Parser to Source Semantics
  • Type changed from defect to enhancement

comment:3 Changed 9 years ago by steggles

  • Owner set to steggles
  • Status changed from new to assigned

comment:4 Changed 7 years ago by benl

  • Version 0.1.2 deleted

comment:5 Changed 7 years ago by benl

  • Status changed from assigned to new

comment:6 Changed 7 years ago by benl

  • Description modified (diff)
  • Priority changed from project to low

comment:7 Changed 6 years ago by benl

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.