cannot close over mutable fields (in deftype)

Description

Simplest case:

Functions should be able to mutate mutable fields in their surrounding deftype (just like inner classes do in Java).

Filed as bug, because the loop special form expands into a fn form sometimes:

Environment

None

Activity

Show:
import
October 1, 2010, 3:35 PM

Comment made by: importer

donmullen said: Updated each run to [_] for new syntax.

Now gives exception listed.

import
October 1, 2010, 3:35 PM

Comment made by: importer

Converted from http://www.assembla.com/spaces/clojure/tickets/274

Nicola Mometto
January 30, 2015, 1:37 PM

The patch for CLJ-1226 makes this work:

If there's interest, I could provide a patch that converts closed over mutable field access by generated fns (for loop/try) into field access on closed over "this", i.e. val -> (.val this)

Nicola Mometto
January 30, 2015, 1:39 PM

Related tickets: CLJ-1075 CLJ-1023

Nicola Mometto
September 12, 2015, 11:35 AM

CLJ-701 could probably make the loop case working

Assignee

Unassigned

Reporter

import

Labels

Approval

Vetted

Patch

None

Fix versions

Priority

Major