Coder Social home page Coder Social logo

duck-language's People

Contributors

vaguery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hermetique

duck-language's Issues

Closure class may cause unreliable behavior

The Closure class relies heavily on Ruby's Proc#curry function to create partially applied functions. This works well for functions of simple arguments, such as arithmetic, where for instance the duck int(5) responds to the message :+ by producing a Closure representing the partial application of addition, 5+?. The Ruby code involved uses Proc#curry to create this result.

The problem is that Ruby's Proc#curry creates a Binding instance that's associated with the arguments passed in, and that Binding includes links to the arguments by reference.

In the case of 5+?, the integer value 5 is immutable; we've got no problem. The 5 is the 5 forever.

In the case of (1, 2, 3) + ?, which in my shorthand represents a Duck List looking for another List to concatenate with, the link by ref to the argument means that if some other event changes it, we can get into trouble.

Now I've been careful to treat arguments as immutable. But there are obviously some mysterious problems floating around in the mix still, because random stress-testing eventually (but rarely) creates a Closure that causes a Ruby error.

The obvious solution is to re-write the Closure class so that it doesn't rely on Binding objects.

Until then, expect arbitrary (and nigh undetectable) errors to crop up from time to time.

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.