Forum
    • Categories
    • Register
    • Login

    Passing Lambda Variables not working in HISE?

    Scheduled Pinned Locked Moved Solved Scripting
    12 Posts 4 Posters 64 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • HISEnbergH
      HISEnberg
      last edited by

      On both my systems I receive an error in the console when trying to pass a labmda variable (from inline function to function). This was prompted by the recent videos @David-Healey shared on the topic. The functions seem to work but I am not sure why I receive the error.

      Interface:! Line 6, column 60: Accessing parameter reference outside the function call
      

      The examples from the HISE docs are also producing the same error. I know I can script around this if necessary but I am curious to know if anyone else is experiencing the same issue?

      Wonder if this is a question for @Christoph-Hart ? Does using lambdas require a certain version of C++? In Visual Studio 2026 the C++ Language Standard is set to ISO C++20 Standard (/std:c++20) , so I think I should be covered here.

      Anyone else seeing these error messages?

      HiseSnippet 790.3ocsUstaSCCE1tqYhFtHlDO.Q6WcnwVur0QYHXr0VnBZWEsL.gPStNNKVKwNJwYiJzdR3kj2.33jrdgU1FUB+inbt4ymO96bbuPIkEEICQXyAiBXH78L5ORnbOvkvEn1MP3GXzgDoXgVop1eT.IJhYiv3kdsVAtPdTx5mubehGQPYSTgPGI4T1639b0Ds816sbOuVDa1.t+Tdu0dsoRwAROYLfmkLJgBHzSImv5Rztky.8FRjKB+XipCcpsEs7NCI6To9v50pUea6pN1jJUYzgCIUXf4s11oFBubSatRF1WQTrHDN+9R6Q8ckmKRSvQ7H9POlVnLpOj4T0sjd15inVK5.WtmcuKKTQHXW5MorsTZY6QFc317w5mT9dXhAqIQLcADmaV3szLvq7eCdyAR3ofT9THshQeZHOPMwhFO20ns.tMcHv8zzPI0WTtefMNPBdHTa3SNk0JDDFGQwZkJstE7YscMM4BOtfY4DKnJtTXEI8YsxDJxEAwp0L+tYgM2z5lVCb4QVg7SbUVtrP1yrd9SzqWXVno3DHGaDAkjOyh5J+HWXKOu3pC3JO1pqasZG3jALD32w33KI49qEkmtlYA..EfySjzisQPHWnxP1tlEt.9bAbNlA20gi13cRJ5JUrCEESNHlWXZ8mlbblqMcELT54wBmqYMsO75BrnH1eHKbcqyHdwrwNBWsyxWV91wWnoWnS4nTzVvUGFvxjudBOJiQ.+8g1MHJhlvkoC7KfEp3Z3favNCZ2SoeELZvhNUICfF9qvMgtBocrGQMaqhdfRlAndLC+TyAEQb0noG37Oz+T5Z6etsPbEidbE0c9XL2bvHTo9efwroN22noiCipl.v7Fs9zhNh4FR+6kwJt3jNDUH+aHrQ2X+9vjZJCxtPv7fM2.mSyVRkKok0Uf9LgchvufUlwxZYblwxWZD4SngxioocA54Z2IQCfIQxa.EfGi.YqxnjNioqy9vX1iozY2pqDXkEMvpKZfasnAt8hFXsEMvcVz.e5MGn9UvWEqj9osMHTmdMSFkfwMEDfAlvVQ+FVk6WTA
      

      Sonic Architect && Software Mercenary

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • HISEnbergH HISEnberg marked this topic as a question
      • Christoph HartC
        Christoph Hart @HISEnberg
        last edited by

        @HISEnberg have you enabled the optimizations in the Scripting Settings?

        Christoph HartC HISEnbergH 2 Replies Last reply Reply Quote 1
        • Christoph HartC
          Christoph Hart @HISEnberg
          last edited by

          @HISEnberg haha don‘t mix up the extremely complex issue of C++ lambdas (where the C++ standard does in fact have an impact) with our little „lamda“ extension to HiseScript where you can just pass on some variables in a function to a sub function call.

          Usually you just need to rename and introduce a variable from a function parameter because you cannot pass on an incoming parameter from the outside function. However this might be another case of „var-local“-gate where I could easily patch things up internally so you and the robot overlords will not need that information in your context window…

          David HealeyD HISEnbergH 2 Replies Last reply Reply Quote 0
          • David HealeyD
            David Healey @Christoph Hart
            last edited by

            @Christoph-Hart He's using lambda's as expected in HISE - I'm not seeing the error he reports, do you see it?

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            1 Reply Last reply Reply Quote 0
            • HISEnbergH
              HISEnberg @Christoph Hart
              last edited by

              @Christoph-Hart hehe that makes sense, they seem super simple in HISE which doesn't appear to be true for C++ 😆

              @David-Healey is correct though, for some reason I am getting an error when using them. If I use his example I get that error message Accessing parameter reference outside the function call

              It doesn't seem to be a breaking change as the code still functions. But I see red in the Console and get nervous....

              Screenshot 2026-02-15 at 2.55.27 PM.png

              HiseSnippet 1128.3ocsV0uaaaCDmJNZq1asXsXO.Z9uj2BLrymMXXnowIY0XIoFyYYcnqnfR5jMWjHEHoRpQQd21izdC1NRIGK2XuUXrZXXq66e2wi2oARQHnTBIwowESx.hyW5NbBWOt2XJiS5eDw4QtmQUZP5Uv5vIYTkBhHNN09QCCm5qSre9qmcHMgxCgYrHjKErP3TVJSOi6fC9IVRxIzH3BVZEs29f9gBdOQhHGwSM2NjLZ3UzQv4TiZq4RdAUMl37staEDu61gc2Kft2l6Gr+t6t+NQaEGQ2bKHLHftIfh2dm3cINe1wQLsPNTS0fh3r9ghnICGKtgWDfKYJVPBXH5RFhQtf8IhjHSJZ3R5MlkDMXZgRQPuLXVYqVQY6qcOiEwti+rx2WYE3MyhpEPm0lGd0lCdcqBuNUf2BfjSEHsdAjdr6vPIKSOShAOegaeNdZFSwyopPoPWxZuulaOApAW2NkdEbhDItyB+s5zYCuM6zo022nAdVozdIAIliGuevapYi.cOQZlfiD9MKk2Dsnvf.M+4QQKU+BwF0KdpsxHlqkhjdzjj.rivWvKjUx2.FFOgwAu3bdnlI3defJ9gSivFdWSSxgVMdei5rXO+uojrNRWmFE0WCoWHNkoz9kP2.vKMJ42BiT85nKUhDncljwWlR213VDTkY70YF2szLtPrIiKdxjw9MYHNTM2vqYyEkdyCTM7NsMgNlOBUqsB6f9MPct3WY7HwM9Mw.GyjoF2Yp8Fe60z667LFh+gOqEd5wfWB5tmgpMMPu1nwa7kfBQqZZYxV2pvqdcInykbS0A+dMUZcDlwkYznYYTq1prDFR967lsJMv5Ol5HHFQejuw1VV2V5kW+lREMzsyxUiKR4owaAkMql+gfwKBj8LA+4V7PoQkljyEZ3kbeawCE58ghhiWnrxtpDPtPwlwZx+MC844oAfrZunQQ7p67yCbW97fpiqBK5qpnnf2myzuLC3KaHForYzL6nDUnpZ6jimTN4.htjA2jIjZBCGR7.2hJMwh5pS4I+R+inZ5TegtECUFH0LSV3bDbMtEnXpTc2i.0UZQFFs6tDfYZQjeXYjOkF.I1fV2s7FF4cUi3jpDllAbAl6KfIdixmnLI2cd9y+3xok489GbCKRiacbcZ5PHiA1nwy1k8mAGjq.qCbbVaAg8Qkg8vbsVvKCYwnoJgDcybIDvo3wrYwwo.UxMymUzqg97A3sNvDqZL0YhTLRT4Danu+7ebyiHJOgpmecjYoco.rmbtc.l47bESOo5R8+21Q8wBwG6NfoCGuXLt1BvH118o.ika1en6wwwPndF.W28jW8oYMN4mE4ZFezYTsjgsGtmmmNDeanP.iNmCIlYB3gswTKcGCsoBLD3QVh+F+TJrqg1oTX2oBIozPo3sgE24Mu6vCrbPLwsumUc7E9PZut2+ddJ1Q91vv4c08LbyU0vsVUC2dUMbmU0vcWUC2aUM7o+2FZFX77bsHs3ZCgb1fisykcbN1NQw1sR9GvO6lUp
              

              Sonic Architect && Software Mercenary

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @HISEnberg
                last edited by

                @HISEnberg have you enabled the optimizations in the Scripting Settings?

                Christoph HartC HISEnbergH 2 Replies Last reply Reply Quote 1
                • Christoph HartC
                  Christoph Hart @Christoph Hart
                  last edited by

                  So here's the journey for the fix:

                  https://opncd.ai/share/JfA7e3J6

                  I completely lost it at the end :)

                  dannytaurusD 1 Reply Last reply Reply Quote 0
                  • dannytaurusD
                    dannytaurus @Christoph Hart
                    last edited by

                    @Christoph-Hart Is there a specific reason you used Haiku? It's not the best model for reasoning about code. It's quite lightweight.

                    I find Opus to be the best, but it's the most expensive I think, and Sonnet is a good balance between cost and performance.

                    Meat Beats: https://meatbeats.com
                    Klippr Video: https://klippr.video

                    David HealeyD 1 Reply Last reply Reply Quote 0
                    • HISEnbergH
                      HISEnberg @Christoph Hart
                      last edited by

                      @Christoph-Hart said in Passing Lambda Variables not working in HISE?:

                      @HISEnberg have you enabled the optimizations in the Scripting Settings?

                      It was this exactly. Disabling the Scripting Optimizations removes the Error. It seems your human reasoning is superior to AI rational here. 🤖

                      @dannytaurus agree, I typically use Sonnet for the best cost/performance usage but Opus is the better for complex/large tasks.

                      Sonic Architect && Software Mercenary

                      1 Reply Last reply Reply Quote 0
                      • HISEnbergH HISEnberg has marked this topic as solved
                      • David HealeyD
                        David Healey @dannytaurus
                        last edited by

                        @dannytaurus I ran into a context limit with sonnet

                        Free HISE Bootcamp Full Course for beginners.
                        YouTube Channel - Public HISE tutorials
                        My Patreon - HISE tutorials

                        Christoph HartC 1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart @David Healey
                          last edited by

                          Is there a specific reason you used Haiku?

                          Nothing else than pure cheapness - I didn't deemed this fix was worthy to use the bigger models :)

                          JK, I just regularly swap out models to compare their performance and I kind of guessed that this is more of a "lookup stuff in the codebase" job than a "be able to reason on the highest level".

                          I ran into a context limit with sonnet

                          Yeah that happened to me weirdly too. To be honest I never really used Sonnet too much - it's either Haiku for the stupid stuff or Opus for the complex things, I find it hard enough to juggle all the other variables so I try to black/white as much as possible.

                          Have you tried the /compact function in Opencode? You basically get around 200k tokens (also displayed as percentage in the sidebar), and at ~85% it starts autocompacting the session to keep on working. Ideally you never go above 50% - 60% of context window usage before exiting plan mode and this is where the /compact function comes in really handy - it basically tells the LLM to summarize the key points, then start fresh with a new context window. You have to be careful at which state in the conversation you do this step, but that's another skill to learn...

                          Christoph HartC David HealeyD 2 Replies Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart @Christoph Hart
                            last edited by

                            Also I would say the days of a messy develop git policy are finally over:

                            https://opncd.ai/share/7MSo7ue3

                            1 Reply Last reply Reply Quote 0
                            • David HealeyD
                              David Healey @Christoph Hart
                              last edited by

                              @Christoph-Hart said in Passing Lambda Variables not working in HISE?:

                              Have you tried the /compact function in Opencode?

                              Sounds promising, looking into it now.

                              Free HISE Bootcamp Full Course for beginners.
                              YouTube Channel - Public HISE tutorials
                              My Patreon - HISE tutorials

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              20

                              Online

                              2.2k

                              Users

                              13.4k

                              Topics

                              116.6k

                              Posts