Giter Site home page Giter Site logo

purescript-native-go-ffi's Introduction

Go foreign export implementations for the standard library

Note that many values are currently missing. Only a minimum set has been implemented โ€“ just beyond enough for the standard compiler tests to pass. Please feel free to contribute any that you have implemented yourself (via a pull request).

Some basic conventions used in this code (not absolutely required, but please try to follow them)

  • Run your code through gofmt
  • Use provided type alias Any instead of interface{}
  • Use provided type alias Dict instead of map[string]Any (intended for when you're dealing with ps records)
  • Use provided type []Any for arrays
  • For input parameters used as-is (i.e. when no type assertion from Any is necessary), simply use a name without a trailing underscore.
    • For example:
      exports["foo"] = func(bar Any) Any {
        return bar
      }
  • For input parameters needing a type assertion from Any to a concrete type, use a name with a trailing underscore, then declare a type-inferred variable, with underscore removed, assigning the type assertion operation to it. This also allows the possiblity of a faster type assertion โ€“ getting and ignoring a failure code instead of a panic. When debugging, you might want to restore the panic possiblity until you're sure it's not an issue.
    • For example:
    exports["foo"] = func(bar_ Any) Any {
      bar, _ := bar_.(int) // the ", _" gets and ignores the error flag
      ...
    }
    • And when debugging:
    exports["foo"] = func(bar_ Any) Any {
      bar := bar_.(int) // remove ", _" to get friendly type assertion panics
      ...
    }

purescript-native-go-ffi's People

Contributors

andyarvanitis avatar alvivi avatar emadshaaban92 avatar sharno avatar

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.