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:

Alex Miller May 30, 2024 at 10:32 PM

Nicola Mometto September 12, 2015 at 11:35 AM

CLJ-701 could probably make the loop case working

Nicola Mometto January 30, 2015 at 1:39 PM

Related tickets: CLJ-1075 CLJ-1023

Nicola Mometto January 30, 2015 at 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)

import October 1, 2010 at 3:35 PM

Comment made by: importer

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

Duplicate

Details

Assignee

Reporter

Labels

Approval

Vetted

Priority

Fix versions

Created February 23, 2010 at 10:41 PM
Updated May 30, 2024 at 10:32 PM
Resolved May 30, 2024 at 10:32 PM