Coder Social home page Coder Social logo

Higher-order macros about firmware HOT 4 CLOSED

andrewmiller1 avatar andrewmiller1 commented on August 30, 2024
Higher-order macros

from firmware.

Comments (4)

kareltucek avatar kareltucek commented on August 30, 2024

Hi Andrew and thanks for getting in touch!

I have considered a possibility of adding a command which would allow executing macros as functions. Unfortunately, the matter is rather complex - call stack would have to be implemented so that you could return from a call, and some sort of typing system which would allow passing arguments... Also one of the complications is that the amount of available RAM of UHK is rather limited, while modules are not-yet implemented and official tracker promises some features which will eat significant amount of memory in the future. ...And the macro-state records are currently quite large. As a result, I don't feel very strongly about implementing such thing - It is not impossible, but so far, it wasn't worth the trouble for me.

One thing I could implement quite easily is an "exec" command, which would execute another macro in place of current macro - i.e., with no possibility of returning to the caller macro. How much would such functionality help you?

Also, could you explain some real-life examples? There might be some other solution not requiring a full-fledged call stack.

from firmware.

luteijn avatar luteijn commented on August 30, 2024

Might consider an 'include X' instead of a 'call X' command that would inline the X macro in the flash. The hard part would be how/when to expand this, ideally it would be done in agent, but probably don't want to go there...

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

I definitely do not want to meddle with writing into flash, since it is an easy way to brick a UHK or at least shorten its life. Also I feel that credibility of the fork could suffer from such decision.

Regarding agent, feel free to implement such thing, but as far as my time goes, I am not going to invest it into agent. Among other things, requiring modified agent would make compatibility a nightmare.

Compared to those suggestions, solving the call stack via RAM is a rather minor inconvenience. Anyway this is more bout how much resources I want to invest into the development - the firmware currently fits my needs quite well so I am reluctant to pursue features which would take huge amount of time.

from firmware.

kareltucek avatar kareltucek commented on August 30, 2024

In the end, I've reconsidered this and implemented a very minimalistic implementation, containing both call and exec. In this implementation, call command simply remembers its caller and returns there. No arguments, no advanced memory management.

See https://github.com/kareltucek/firmware/releases/tag/v8.5.4.kt.20

from firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.