question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In #19 and #20 some confusion arose around the purpose of the registry. Currently it has the following responsibilities, which may or may not be useful:

Store available specs for easier access

So you can do this:

define("string", p.string)
conform("string", "foo")

Instead of always having to do it like this:

const string = p.string
conform(string, "foo")

However the underlying question is probably how different modules share their specs or provide them to “userspace.” Should they define all their things to store them in the registry? (I don’t think it’s possible with npm as, if I recall correctly, you can end up with depdendency A using js.spec v1 and dependency B with js.spec v1.1, effectively using different registry instances) Also, they still would need to share they IDs to look up in the registry.

// module A
export const specA = Symbol("string")
define(specA, p.string)

// module B
import {specA} from 'a'
conform(specA, "foo")

So maybe overall it’s better to use regular es6 modules for transporting specs directly.

// module A
export const specA = p.string

// module B
import {specA} from 'a'
conform(specA, "foo")

Which would make the registry obsolete.

Name the specs

The one other reason why the registry exists is that, since you give a semantically useful ID to define, it can auto-name the specs, which is super important for error messages. Generic error messages are not helpful, especially when you consider two syntactically equal specs that have different semantics. (It’s in the morning, I don’t have a good example ready.)

Here I would just make the name part of a spec’s data, it’s cleaner anyways.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
mattbishopcommented, Mar 24, 2017

Using modules makes more sense in a JS context. It simplifies the design and also improves the understandability–I can directly inspect the imported spec, whereas in a registry it’s hard to see where it came from, or worse, who redefined it.

1reaction
prayerslayercommented, Mar 25, 2017

So to sum it up, we agreed on:

  • Removing the registry
  • Thus no longer allowing specs to be referenced by symbol or string ID
  • Making the name part of the spec/predicate API

Correct me if I’m wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wisconsin Registry | Your Career Development & ...
Registry Credentials combine higher education with job specific skills and practical knowledge that can help advance your career.
Read more >
Wedding Registry, Baby Registry & Gift Lists | MyRegistry. ...
MyRegistry partners with your favorite retailers so you can manage all registries in one place. Start a registry for your wedding, baby, wish...
Read more >
Massachusetts Registry of Motor Vehicles (RMV) - Mass.gov
Visit the RMV's Online Service Center for over 40 transactions that can be completed online and skip the trip to the RMV.
Read more >
Gift Registry & Lists - Target
Create or find a wedding, baby, college, or housewarming registry or a registry for any special occasion. Create a registry so your kids...
Read more >
Amazon Registry & Gifting
Use Amazon Registry and Gift Lists to create and share your gift ideas for any event, with the convenience and perks you love...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found