Giter Site home page Giter Site logo

segfault on IO.print(new List) about wren HOT 6 CLOSED

wren-lang avatar wren-lang commented on July 28, 2024
segfault on IO.print(new List)

from wren.

Comments (6)

kmarekspartz avatar kmarekspartz commented on July 28, 2024

Or:

> var x = new List
> x.add(1)
wren(90830,0x7fff7748b310) malloc: *** error for object 0x2: pointer being realloc'd was not allocated
*** set a breakpoint in malloc_error_break to debug
zsh: abort      ./wren

from wren.

munificent avatar munificent commented on July 28, 2024

Ah good catch. You can probably cause the same problem by calling new on any of the built-in classes: Bool, Num, Fiber, Function, etc.

The problem is that instances of those types are special in the VM. Calling new creates the wrong type and then methods on that object go haywire.

It would be nice if new List and new Fiber could be made to do something useful, but that will be tricky with the sematics of how new is compiled. The simplest fix is probably just to make those classes implement new methods that raise runtime errors.

from wren.

tamc avatar tamc commented on July 28, 2024

Can't replicate this as of 84ead3b on OSX Yosemite

> IO.print(new List)
[]
> var x = new List
> x.add(1)
>

Is it fixed?

from wren.

kmarekspartz avatar kmarekspartz commented on July 28, 2024

I'll try this out today.

from wren.

kmarekspartz avatar kmarekspartz commented on July 28, 2024

It works for me now.

from wren.

munificent avatar munificent commented on July 28, 2024

\o/

from wren.

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.