[clean-list] "Error in backend: File backend.c, Line 654" using custom instance of Array
David C. Norris
david at UnusualSolutionsThatWork.com
Tue Mar 26 00:50:57 MET 2013
While experimenting with a (trivial) custom instance of Array (to determine whether I may hope to use some of the new updating syntax with a more substantial instance), I encounter the following compile error:
Error in backend: File backend.c, Line 654 (!(originalsdef->sdef_arfun == BEArrayUpdateFun))
clm: reading compiler result failed: No such file or directory
I get the same message, whether using clm 2.4 on Mac OS X or 2.3 on Linux.
I am alerting you to this error, as it seems to represent an undesired failure mode. But I also wonder in particular, does the current release support creating a custom instance of Array, and then exploiting the special updating syntax?
The repro follows.
Best Regards,
David Norris
-------------------
TestArray.icl
-------------------
module TestArray
import _ArrayTest
Start:: Ar3 Int
Start # x = (A3 1 2 3)
= {x & [2] = 7}
// Note that, by contrast, the following code compiles fine:
// Start:: (Int, Ar3 Int)
// Start # x = (A3 1 2 3)
// = replace x 2 7
//
// and gives the expected output:
// (2,(A3 1 7 3))
-------------------
_ArrayTest.dcl
-------------------
definition module _ArrayTest
import StdEnv, StdInt, StdArray
import StdOverloaded
// Make a 3-element instance of Array
::Ar3 a = A3 a a a
instance Array Ar3 a
-------------------
_ArrayTest.icl
-------------------
implementation module _ArrayTest
import StdEnv, StdInt, StdArray
import StdOverloaded
instance Array Ar3 a
where
select (A3 x y z) index
| index == 1 = x
| index == 2 = y
| index == 3 = z
= abort "Index out of range"
uselect (A3 x y z) index
| index == 1 = (x, A3 x y z)
| index == 2 = (y, A3 x y z)
| index == 3 = (z, A3 x y z)
= abort "Index out of range"
size arr = 3
usize arr = (3, arr)
update (A3 x y z) index el
| index == 1 = A3 el y z
| index == 2 = A3 x el z
| index == 3 = A3 x y el
= abort "Index out of range"
createArray size el = A3 el el el
_createArray size =
abort "_createArray should not be called"
replace (A3 x y z) index el
| index == 1 = (x, A3 el y z)
| index == 2 = (y, A3 x el z)
| index == 3 = (z, A3 x y el)
= abort "Index out of range"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/clean-list/attachments/20130325/29d3d9f1/attachment.html>
More information about the clean-list
mailing list