Better HN
topnewbestaskshowjobs
Log inSign up

yagoham

3 karma · joined Oct 22, 2020 (6y ago) · 3 submissions

Submissions

comment 6y ago · link · parent

Hi, blog post author here. As stated at the beginning, the project is still WIP, and I didn't expect it to end on HN. Sorry for the lack of documentation and convincing example for now !

The post is intended to present the ideas and let people look at the repo, but while the core language is rather complete, a lot of small but important things are still missing to make it usable right now. I sidestepped this issue to still be able to illustrate some points with simple examples.

To answer your questions:

- numToStr would be either in a standard library, or implemented here using standard library functions. It does not exist currently

- the fact that the urls are non empty could be either enforced by the contract itself (ie use a NonEmptyUrl contract). Or you could combine a NonEmptyStr and a Url contract via merging. By default, things with a contract without a default must be present.

- I'm not sure I fully understand your last point, but I don't think a configuration file could "redefine" a function in any meaningful way. Say you write a program "main.ncl", which import some external downloaded source, check it against a contract you've written, and generate a config accordingly. Since the language is pure and variable are lexically scoped, nothing from an import could redefine anything in your current scope, be it your contracts or your functions.

comment 6y ago · link · parent

The Nickel interpreter is intended to offer a mechanism to make it possible to extend it to add "effects", which is really just a pompous name for an external call. The idea is that, if you want to integrate it with Terraform for example, you would want to have a "getIp" effect to retrieve the IP of a machine once it has been evaluated. So you implement your external handler (say in Rust or whatever), and then you can call "getIp" from a Nickel program. Currently, we see no reason Nickel would ship with any effect by default. These are really just for extension purpose. Such additional effects would be required to be commutative in order not to hurt parallelizability, but you can't enforce that mechanically, so you'll have to trust the implementer.

comment 6y ago · link · parent

Hi, blog post author here. The idea behind effects in Nickel is to have very limited, use-case specific effects that can extend the standard interpreter. The goal is, as the example suggest, to make it able to interoperate with an external tool when absolutely necessary, such as Terraform or Nix. The idea is really not to have general effectful functions such as readFile or launchMissiles.