https://github.com/clonkk/parachute
Nimble package for tagging and tracking unsafe stuff in Nim !
https://github.com/clonkk/parachute
hacktoberfest nim tags unsafe
Last synced: about 1 month ago
JSON representation
Nimble package for tagging and tracking unsafe stuff in Nim !
- Host: GitHub
- URL: https://github.com/clonkk/parachute
- Owner: Clonkk
- Created: 2020-12-14T00:56:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T09:41:13.000Z (7 months ago)
- Last Synced: 2025-04-01T16:58:33.115Z (about 2 months ago)
- Topics: hacktoberfest, nim, tags, unsafe
- Language: Nim
- Homepage: https://clonkk.github.io/parachute/
- Size: 64.5 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
*********
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``.
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 :
.. code-block:: nim
import system except addr, unsafeAddr
import parachute
openParachuteNote that unsafeAddr is deprecated, but is kept for backward compat.
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.