Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Functions, Polymorphic Opcodes

Date2006-10-12 14:31
FromMichael Gogins
SubjectRe: [Cs-dev] Functions, Polymorphic Opcodes
Going entirely function would break backwards compatibility, would it not?

That is why I prefer having all opcodes be callable as functions and all functions be callable as opcodes. Then those who prefer functions, like myself, could go entirely functional without impeding the work of others who do not.

Regards,
Mike

-----Original Message-----
>From: jpff 
>Sent: Oct 12, 2006 3:36 AM
>To: Michael Gogins , Developer discussions 
>Cc: csound-devel@lists.sourceforge.net
>Subject: Re: [Cs-dev] Functions, Polymorphic Opcodes
>
>I would much prefer there to be a clear distinction between opcodes and
>functions, as indeed there was in my "new parser".  I guess I just
>think it would be clearer and easier to explain.
>  Alternative view is to go entirely functional....
>==John ffitch




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-10-12 15:33
From"Steven Yi"
SubjectRe: [Cs-dev] Functions, Polymorphic Opcodes
AttachmentsNone  

Date2006-10-12 17:09
FromAnthony Kozar
SubjectRe: [Cs-dev] Functions, Polymorphic Opcodes
I would prefer that we be able to call any function (or operator) using
opcode syntax because it is more efficient.  There are times when you cannot
use --expression-opt and might prefer to write

aa  add  ab, ac

instead of 

aa = ab + ac

If I understand correctly, all that would be needed to allow this would be
to add the 0xffff entries for all functions and operators.

By the way, it WAS possible under Csound 4 to write the following:

aa  add_aa  ab, ac

in the orchestra code.  This would imply to me that when add_aa was changed
to add.aa that the parser should have been changed to allow periods in the
opcode name to keep "combatibility".  (Yes, I realize that it was an
undocumented side effect of the way that things worked ... would be better
to just add the 0xffff entries ...)

I am not sure whether any opcode (with[out] a single argument) should be
allowed to behave as a function.  I guess it really depends on whether you
think that a function should always return the same value for the same input
or whether it is OK for opcodes like readclock to be functions.

Another point that I think should be considered changed is the way that the
parser chooses between k-rate and i-rate versions of a function.  The
current method of looking at the input argument's rate leads in my opinion
to some non-intuitive and even moronic situations.

For example, when using the tbN() family of functions with "vectorial
signals", I have wanted to print the values of a function table like this:

fprintks    "CAstates", "%f %f %f %f \\n", \
            tb0(0), tb0(1), tb0(2), tb0(3)

expecting that since the arguments to fprintks are k-rate, that I would get
the k-rate version of tb0().  Instead you get the i-rate version and have to
instead initialize a bunch of dummy k-rate variables:

k0    init    0
k1    init    1
k2    init    2
k3    init    3
fprintks    "CAstates", "%f %f %f %f \\n", \
            tb0(k0), tb0(k1), tb0(k2), tb0(k3)

This is really annoying when you are trying to access many more than four
table slots!  I really see no value in interpreting tb0() this way, but
perhaps there are other functions or situations where this makes sense ...
??

Anthony Kozar
anthonykozar AT sbcglobal DOT net


Michael Gogins wrote on 10/12/06 9:31 AM:

> Going entirely function would break backwards compatibility, would it not?
> 
> That is why I prefer having all opcodes be callable as functions and all
> functions be callable as opcodes. Then those who prefer functions, like
> myself, could go entirely functional without impeding the work of others who
> do not.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-10-17 12:10
From"Steven Yi"
SubjectRe: [Cs-dev] Functions, Polymorphic Opcodes
AttachmentsNone  

Date2006-10-17 15:58
FromAnthony Kozar
SubjectRe: [Cs-dev] Functions, Polymorphic Opcodes
Thanks for the reply Steven.

Steven Yi wrote on 10/17/06 7:10 AM:

> kcounter = 0
> loop_start:
> tablew(table(kcounter, imytable) * 5, kcounter, imytable)
> loop_lt kcounter, 1, 10, loop_start

This does seem useful.  And it gives users the option of using Csound either
in the traditional "assembler" style or a more "C-like" style.

> As for the fprintks example, would it work to call:
> 
> fprintks    "CAstates", "%f %f %f %f \\n", \
> tb0(k(0)), tb0(k(1)), tb0(k(2)), tb0(k(3))

You are right of course.  I think Istvan added k() in response to my last
complaint about this issue and I just forgot about it.  It is a reasonable
solution to the problem -- thanks for reminding me.

> Perhaps it would suffice to have some general coding guidelines,
> perhaps put together a tips page in the manual?

It would probably help me :)  Despite having worked on Csound's internals I
still feel like a novice user sometimes.  Too much time programming and not
enough time actually making music with Csound!

Anthony


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net