temperlang / temper

2 stars 0 forks source link

Support external libraries (aka Templandia) #140

Open tjpalmer opened 1 month ago

tjpalmer commented 1 month ago

Some things to consider:

We currently can use git submodules for external dependencies, but it would be nice not to rely on git or symlinks.

ben-509 commented 1 month ago

I think that PR is a good first step. I'm a little skeptical about having URLs directly in the imports...

For various reasons, you'd want to lock it down to a specific hash, and that almost certainly needs to be external to the code. So my principal complaint against using URLs is that it's not doing what it says, import("https://github.com/foo/bar") will actually mean import("https://github.com/foo/bar/tree/v3") but really some specific SHA in a lockfile somewhere.

That said, it'd be ideal for one-off scripts. Really, I think what I'd be looking for is some scheme whereby we're actually doing the imports in config.temper.md and making those names globally available.

And probably, rather than trying to infer everything from a URL, importGit(host="github.com", owner="foo", "repo="bar", ref="my-tag") could work. importGihub and importGitLab would just set the host for you. I'd love it if these were written in Temper so new users can see exactly what they're doing, especially around caching and such.

tjpalmer commented 4 weeks ago

Good thoughts. Thanks much!

Really, I think what I'd be looking for is some scheme whereby we're actually doing the imports in config.temper.md and making those names globally available.

That's actually what I'm doing in that PR, except for the vague URL thing that you're concerned about. The url is only mentioned in the config, and then other modules in the library just use a simple name.