Giter Club home page Giter Club logo

Comments (8)

tannewt avatar tannewt commented on July 21, 2024

I don't think we should change our libraries for this. Data descriptors simplify the drivers a bunch.

Would you mind opening an issue in MicroPython's repo for them to enable it? They should be interested in having our libraries compatible. I can follow up on it as well.

from adafruit_blinka.

cefn avatar cefn commented on July 21, 2024

I'm taking Damien's inline comment...

// This costs some code size and makes all load attrs and store attrs slow

...and the statements at https://github.com/micropython/micropython/wiki/Differences to mean they have already decided to exclude it by default, so I think the debate has been had once and settled in favour of performance and resource-efficiency, given there are always substitute language structures.

Do you think we should open it as an issue in any case to record the decision?

BTW I am not proposing that libraries are changed. Rather that people running on Micropython would have to run a post-load monkey-patching operation to switch descriptors for properties on classes where they are found. This would be after import and before use, and not require any code-changes to the module source. Not sure when and how this strategy might fail, though. E.g. are frozen-modules any different in terms of dynamic manipulation. It might be a crazy thought until I've worked through it.

from adafruit_blinka.

tannewt avatar tannewt commented on July 21, 2024

I think opening an issue is still worth while. That decision was made before we had 50+ libraries. :-) Determining the code size increase would be a good piece of info to have too.

What would they switch the descriptors to? Properties are implemented using data descriptors.

Frozen modules won't be an issue because we're assuming its a MicroPython build. mpy files are identical to py files after load.

from adafruit_blinka.

cefn avatar cefn commented on July 21, 2024

What would they switch the descriptors to? Properties are implemented using data descriptors.

I'm just picking up on the https://github.com/micropython/micropython/wiki/Differences comment;
"So far, we were able to implement all native Python features (like properties) without explicit descriptors."

If it's not been covered again recently I'll open an issue.

from adafruit_blinka.

cefn avatar cefn commented on July 21, 2024

Ancient discussion of strategy for implementing properties at micropython/micropython#474 and
https://github.com/micropython/micropython/blob/6e675c1baaf0de0d56a2345376d6b5600bfab3aa/py/mpconfig.h shows properties configured by default across all current builds, so the property patching strategy should be feasible if no official descriptor support (or while waiting for it).

from adafruit_blinka.

cefn avatar cefn commented on July 21, 2024

You can find the issue on enabling descriptor support on official images as recently raised at https://github.com/micropython/micropython/issues?utf8=%E2%9C%93&q=is%3Aissue+descriptor

from adafruit_blinka.

tannewt avatar tannewt commented on July 21, 2024

Upstream issue is micropython/micropython#3644 and I've subscribed to it. Thanks!

from adafruit_blinka.

makermelissa avatar makermelissa commented on July 21, 2024

Closing as it appears descriptors were added.

from adafruit_blinka.

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.