[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is gcc able to handle anonymous functions?

From: Marc Hohl
Subject: Re: Is gcc able to handle anonymous functions?
Date: Thu, 05 Jul 2012 08:26:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

Am 05.07.2012 08:14, schrieb Joe Neeman:

On Thu, Jul 5, 2012 at 12:37 AM, address@hidden <mailto:address@hidden> <address@hidden <mailto:address@hidden>> wrote:

    On 4 juil. 2012, at 20:10, Marc Hohl wrote:

    > Am 04.07.2012 13:29, schrieb David Kastrup:
    >> Marc Hohl <address@hidden <mailto:address@hidden>> writes:
    >>> Hello list,
    >>> the topic is somewhat over my head, but perhaps someone with more
    >>> insight can answer this question?
    >> I think that gcc likely can, don't know about g++, and we don't
    want to
    >> rely on it anyhow.
    > Ok.
    > Well then, is there an alternative?
    > I want to get rid of (issue 1320), and I have
    managed to get all
    > definitions but Bar_line::non_empty_barline into scheme.
    > In lily/, I have
    > Grob *bar = Pointer_group_interface::find_grob (right_col,
    > ly_symbol2scm ("elements"),
    > Bar_line::non_empty_barline);
    > The simple approach
    > bool non_empty_barline =
    > ly_scm2bool (scm_call_1 (ly_lily_module_constant
    ("bar-line::non-empty-barline"), right_col->self_scm ()));
    > with
    > (define-public (bar-line::non-empty-barline grob)
    > (and (grob::has-interface grob 'bar-line)
    >     (pair? (ly:grob-extent grob grob X))))
    > doesn't work.
    I just realized that there's an easier way to do this w/ existing
    code conventions.  You can overload
    Pointer_group_interface::find_grob so that it accepts a simple
    closure as the third argument.  Then, wrap the Scheme function in
    a simple closure.

Why not just leave the function in C++? I have nothing against porting things to scheme, but in this case it just seems like an exercise in making things more complicated, for no gain.
The function Bar_line::non_empty_barline is defined in lily/ After handling the stuff concerning issue 1320 this would be the only remaining function in so the idea was to move these
remaining five lines of code into scheme, too.

If there is an alternative where I can put the funtion in, I can drop the conversion c++->scheme.

Since both possibilities exceed my knowledge, I have to rely on experts ...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]