[nem-bug] [Nemerle 0000797]: problem with caching of properties
returning arrays
feedback at nemerle.org
feedback at nemerle.org
Thu Nov 30 14:06:08 CET 2006
The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=797>
======================================================================
Reported By: malekith
Assigned To: malekith
======================================================================
Project: Nemerle
Issue ID: 797
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 11-29-2006 15:20 CET
Last Modified: 11-30-2006 14:06 CET
======================================================================
Summary: problem with caching of properties returning arrays
Description:
class A {
public Foo : array [int]
{
get { System.Console.WriteLine ("Buffer_get called"); array (1) }
}
}
def a = A ();
a.Foo [0] += 2;
Foo is called twice.
======================================================================
----------------------------------------------------------------------
nazgul - 11-29-06 21:39
----------------------------------------------------------------------
The problem is
Foo : array [int] {
get { array(1) }
}
vs
Foo [x : int] : int {
get { 0 }
set { }
}
which is not distinguishable on syntax level:
Foo [0] += 1;
but requires different approach:
def tmp = Foo;
tmp [0] = tmp [0] + 1;
for array vs just leaving
Foo [0] = Foo [0] + 1 ---> set_Foo (0, get_Foo (0))
I guess we should just use Cached for whole cached object - this requires
Cached to be handled properly in function/property context:
$cached = Foo [0];
$cached_ref = $cached_ref + 1;
would automatically convert to set_Foo (0, get_Foo (0)) if we are dealing
with properties.
----------------------------------------------------------------------
nazgul - 11-29-06 21:48
----------------------------------------------------------------------
And current caching macro fails on:
class A {
public Foo[x : int] : int
{
get { 1 }
set { }
}
public Foo[x : int, y : int] : int {
get {1 }
set { }
}
public Bar () : void {
Foo[0] += 1;
}
}
----------------------------------------------------------------------
malekith - 11-30-06 10:56
----------------------------------------------------------------------
Right. Caching the entire expression at the TExpr level seems like a much
better (and simpler) idea. Working on it.
----------------------------------------------------------------------
malekith - 11-30-06 14:06
----------------------------------------------------------------------
Resolved on trunk, r7027
Issue History
Date Modified Username Field Change
======================================================================
11-29-06 15:20 malekith New Issue
11-29-06 21:39 nazgul Note Added: 0001536
11-29-06 21:48 nazgul Note Added: 0001537
11-30-06 10:56 malekith Note Added: 0001538
11-30-06 14:06 malekith Status new => resolved
11-30-06 14:06 malekith Resolution open => fixed
11-30-06 14:06 malekith Assigned To => malekith
11-30-06 14:06 malekith Note Added: 0001539
======================================================================
More information about the bugs
mailing list