[sac-user] Function Specialization Hint

Vlad Ureche vlad.ureche at epfl.ch
Fri Oct 7 17:35:16 CEST 2011


On Fri, Oct 7, 2011 at 5:04 PM, Scholz, Sven-Bodo <s.scholz at herts.ac.uk>wrote:

>
> you missed out putting a return type there.
> Sorry, that the error-message is slightly misleading.
>

Thank you for the quick answer. Unfortunately I still couldn't make it
parse:

--------------------------
ABORT: line 72  file: specialize.sac
ABORT: syntax error at pos 47: ',`
ABORT: specialize int[.,.] processMatrix(int[100,100], int);
ABORT:                                               ^ (the cursor indicates
the error at the comma between int[100,100] and int)

*** Compilation failed ***
*** Exit code 1 (Loading SAC program)
*** 1 Error(s), 0 Warning(s)
--------------------------

I tried several combinations and it doesn't seem to accept any of them.
Could you please paste the grammar rules that take care of the
specialization parsing? Maybe I'm missing a special character I need to
place somewhere.

Just for the record, I managed to work around this by creating specialized
versions of this function that call the generic one and a dispatch:

int[.,.] processMatrixSpecialized100(int [100, 100] array, int times) = {
return processMatrixGeneric(array, times); }
int[.,.] processMatrixSpecialized150(int [150, 150] array, int times) = {
return processMatrixGeneric(array, times); }
int[.,.] processMatrix(int [.,.] array, int times) = { if (all(shape(array)
== [100, 100])) processMatrixSpecialized100(array, times); ... }


Thank you!

Vlad Ureche
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sac-home.org/pipermail/sac-user/attachments/20111007/d7dff7a0/attachment-0002.html>


More information about the sac-user mailing list