Giter VIP home page Giter VIP logo

parachute's Introduction

Parachute

Introduction

A Nimble module when you need a parachute !

This is a simple Nimble module that uses that uses tag tracking to track usage of addr, cast, unsafeAddr.

It also defines unsafe template that simple {.push: tags[Unsafe].} to the scope.

Usage

Parachute defines castTag, addrTag and unsafeAddrTag, that simply calls the system version while adding tags: [Unsafe].

Once the tags is present, it is trivial to allow/forbid tags at compile time. Read Nim's manual for more detailed information.

Working with existing codebase

To avoid having to change too much your code, there is a small macro openParachute() which declare addr and unsafeAddr as templates. Since addr cannot be overloaded, it will have to be excluded from system.

In short, if you want to use the tagged version of addr and unsafeAddr do the following in your file :

import system except addr
import parachute
openParachute

This way of doing things avoid exporting addr``and ``unsafeAddr identifier that would potentially collide.

The special case of cast

Since cast is a keyword of the language, it cannot be replaced or used as an identifier. This means that for use the tagged version of cast you have to explicitly call castTag.

But since cast is most often called in conjonction with addr or unsafeAddr, it should be too impactful.

Documentations and examples

The documentation is accessible here .

Look into the tests/ folder for more elaborate examples.

Improvements

What really would improve this concept would be:

  • Being able to remove a tag. This would make wrapping unsafe code a breeze !
  • Being able to "forbid" a tag without filtering every offet effects. Something like {.tags: [not Unsafe].} to explicitly forbid a tags without failing to compile on others.

parachute's People

Contributors

clonkk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.