Giter Club home page Giter Club logo

Comments (10)

mmatera avatar mmatera commented on May 18, 2024 1

I am working on it. I hope to have it later today.

from mathics-core.

rocky avatar rocky commented on May 18, 2024

From a pure programming standpoint, you don't add try unless the access where the error is being called is out of your control and breaks modularity.

It sounds like a good high-level solution is something more along the lines about checking whether the lhs is a protected function as you observe rather than a more low-level solution about whether some sort of element is compound or not.

from mathics-core.

adamantinum avatar adamantinum commented on May 18, 2024

From a pure programming standpoint, you don't add try unless the access where the error is being called is out of your control and breaks modularity.

It sounds like a good high-level solution is something more along the lines about checking whether the lhs is a protected function as you observe rather than a more low-level solution about whether some sort of element is compound or not.

Since the error is the missing leaves, could be possibie to inizialize an empty leaves, so process_assign_n() function exercutes without error?

from mathics-core.

TiagoCavalcante avatar TiagoCavalcante commented on May 18, 2024

@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed def = 1.

I believe this should be something like the following:

if not lhs.hasattr("leaves"):
  return evaluation.warning("You really shouldn't do this")

(warning: pseudo-code above)

from mathics-core.

adamantinum avatar adamantinum commented on May 18, 2024

@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed def = 1.

As far as I tried it happens only with N, if I run e.g. If=1 I get correctly "Set::wrsym: Symbol If is Protected."
To get the same result with N I had to comment all lines which call leaves attribute. I don't know the difference in implementation, but initializing leaves would do the job (despite it be an ugly workaround)

from mathics-core.

TiagoCavalcante avatar TiagoCavalcante commented on May 18, 2024

@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed def = 1.

As far as I tried it happens only with N, if I run e.g. If=1 I get correctly "Set::wrsym: Symbol If is Protected." To get the same result with N I had to comment all lines which call leaves attribute. I don't know the difference in implementation, but initializing leaves would do the job (despite it be an ugly workaround)

@adamantinum with "do the job" it lets the user assign or show the warning? Anyway, if you could make a PR to we test, that'd be great.

@rocky @mmatera this is showing that something is really wrong, N should be like any symbol. I don't know even the place to look for this, do you have an idea?

from mathics-core.

adamantinum avatar adamantinum commented on May 18, 2024

@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed def = 1.

As far as I tried it happens only with N, if I run e.g. If=1 I get correctly "Set::wrsym: Symbol If is Protected." To get the same result with N I had to comment all lines which call leaves attribute. I don't know the difference in implementation, but initializing leaves would do the job (despite it be an ugly workaround)

@adamantinum with "do the job" it lets the user assign or show the warning? Anyway, if you could make a PR to we test, that'd be great.

@rocky @mmatera this is showing that something is really wrong, N should be like any symbol. I don't know even the place to look for this, do you have an idea?

It means it returns the warning N is a protected symbol, as it does for any other Mathics symbol.
I'll try to make a PR, after I'll have understood how leaves attribute works and is defined

from mathics-core.

adamantinum avatar adamantinum commented on May 18, 2024

That's perfect, with the PR it works as it should do. Is there a reason why N behaves differently from other Symbols?

@TiagoCavalcante regarding the place where looking for things like that, isn't there a manual or a scheme of how mathics code is organized?

from mathics-core.

TiagoCavalcante avatar TiagoCavalcante commented on May 18, 2024

@adamantinum yes, there is buy it isn't that complete, anyway that isn't necessary as mmatera fixed it.

from mathics-core.

adamantinum avatar adamantinum commented on May 18, 2024

@adamantinum yes, there is buy it isn't that complete, anyway that isn't necessary as mmatera fixed it.

Yes, I've seen the PR.
I'm interested in the manual mostly regarding future contributions.

from mathics-core.

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.