Code Monkey home page Code Monkey logo

Comments (7)

eliotmcintire avatar eliotmcintire commented on July 30, 2024

This was an old issue. inherits doesn't work on simList. It was LONG ago changed to class( ). I am undoing the portion of the commit that made this 0129288 . It must stay class or we need to diagnose why inherits fails and fix that. For now, class is fine.

EDIT: I am incorrect on this diagnosis. There was something that happened a while ago with this, but I am mis-remembering the details. This error may simply be a case of correcting the use of inherits, which takes 2 arguments. Working on it...

from spades.core.

eliotmcintire avatar eliotmcintire commented on July 30, 2024

It may have been a speed issue, but I think both are "fast enough"

microbenchmark::microbenchmark(inherits(sim, "simList"), class(sim)== "simList", is(sim, "simList"), times = 1e4)
Unit: nanoseconds
                     expr  min   lq      mean median   uq   max neval cld
 inherits(sim, "simList")  880 1174 1778.6009   1467 1760 23462 10000  b 
  class(sim) == "simList"  293  587  967.7314    880  880 43698 10000 a  
       is(sim, "simList") 4986 6159 7612.0034   6452 6746 50443 10000   c

from spades.core.

achubaty avatar achubaty commented on July 30, 2024

I've fixed it in my branch.

Note we use inherits(sim, "simList") elsewhere with no issue.

from spades.core.

achubaty avatar achubaty commented on July 30, 2024

if it's a speed issue, should we change all instances of inherits(sim, "simList") to class(sim) == "simList"?

from spades.core.

eliotmcintire avatar eliotmcintire commented on July 30, 2024

I think the difference is only relevant if the function is being run EVERY event. Even then, probably fine. I believe inherits(...) is "more correct", but I don't really know the strong arguments.

from spades.core.

eliotmcintire avatar eliotmcintire commented on July 30, 2024

See discussion here: https://stackoverflow.com/questions/27923345/whats-the-difference-between-is-and-inherits
(is vs. inherits). They note the integer difference ... I will look for discussions about class vs inherits

from spades.core.

achubaty avatar achubaty commented on July 30, 2024

Yes, I believe inherits is more correct.

But since it's in the doEvent, I'll make the change based on speed.

from spades.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.