[chuck-dev] segmentation fault on function call

Spencer Salazar spencer at ccrma.stanford.edu
Tue Jan 29 13:34:44 EST 2013


I think what you are going for is this?

class Foo
    1.0 => float _f;

    fun float foo(float f)
        f => _f;
        return _f;

    fun float foo()
         return _f;

Foo f;
42.0 => f.foo;
<<<"foo", f.foo()>>>;

The canonical ChucK setter/getter paradigm is two functions, one each for
setting and getting. This is more or less uniformly adhered to by the
built-in ugens. Calling f.foo (without parentheses), if foo is a function,
is fairly atypical, since it evaluates to an internal memory address that
doesn't have much significance at the ChucK code level. That being said,
atypical use cases still should not be met with a crash, so thanks for
bringing this up!


On Mon, Jan 28, 2013 at 3:50 PM, Kassen <signal.automatique at gmail.com>wrote:

> On Mon, Jan 28, 2013 at 05:22:15PM -0600, Michael Heuer wrote:
> >
> > Yes, odd.
> >
> > That pattern is my best attempt to make classes/chugens/chubgraphs
> > look more UGen-ly, in that you can use value => foo notation and
> > f.foo(value) notation.  Typically in my use cases there are side
> > effects in the function call in addition to setting the value of the
> > field, so just doing value => f._f in the example above would not be
> > sufficient.
> >
> Yes got it. In a way this is a inconsistency;
> 3 => my_gain.gain; //works
> 3 => my_class_instance.funny(); //has to be done like that.
> I agree with you that this is inconsistent to the point where it might
> bother us. I'd go as far as claiming that the "=>" operator is already
> so overloaded that the only way to make sure ChucK will stay
> consistent is to also allow for user-defined further overloading. I
> can see why serious CS people might hide under the nearest furniture
> over this idea, but I'm sticking to it.
> >
> > Thanks.  If you're not breaking ChucK or blowing up a channel on your
> > mixer occasionally, you're not trying hard enough.  :)
> IMHO mixer channels on mixers beyond the "bargain" level should not
> blow either, at least not when fed signals somewhat similar to
> reasonable audio ones. Mistakes in code and patching can and will
> happen. We expect error handlers and mixers to deal with those; I
> expect the pre-fader listen function to tell me when I patched
> something wrong *before* I open the fader and risk damaging a rack of
> amps, stack of speakers and potentially the ears of a few hundred
> people; that's what the mixer is for, aside from mixing and routing.
> Same thing with a error-handler. Error-handlers should be able to take
> abuse, that is what they are there for.
> Before we are at that level we clearly need to go through this phase
> where any advanced ChucK project will yield bug-reports and we need
> the kind of ChucKist like yourself who'll file them. :-)
> Yours,
> Kas.
> _______________________________________________
> chuck-dev mailing list
> chuck-dev at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-dev/attachments/20130129/c0ba5a07/attachment-0001.htm>

More information about the chuck-dev mailing list