speced / bikeshed

:bike: A preprocessor for anyone writing specifications that converts source files into actual specs.
https://speced.github.io/bikeshed
Creative Commons Zero v1.0 Universal
1.11k stars 200 forks source link

Check types of algorithm inputs and outputs. #673

Open jyasskin opened 8 years ago

jyasskin commented 8 years ago

@domenic says ECMAScript just did something like this.

domenic commented 8 years ago

https://github.com/tc39/ecma262/pull/545 in progress

mikewest commented 8 years ago

I'd like something like it in Bikeshed, as it's implicitly what I'm doing in a lot of specs anyway.

It doesn't look like the patch @domenic referenced actually landed in the ecma repo; did y'all go in a different direction?

mikewest commented 8 years ago

FWIW, some kind of type checking (even something as small as counting the number of arguments) would have prevented me from making the refactoring mistake in https://github.com/w3c/webappsec-csp/pull/105#discussion_r74672732.

tabatkins commented 8 years ago

So my big challenge here is designing something that isn't just invisible metadata that can get obsolete and disconnected from the text.

Hmm. Thinking out loud:

Then, on the calling side:

Typing can come later, but this will at least give us basic variable annotations. It'll detect algo changes and missing arguments.

jyasskin commented 8 years ago

That looks mostly good. We also need to be able to write things like <algo-call><a>foo the bar</a> with a <param>baz</param> of <var>quux</var></algo-call> where the parameter and argument have different names.

tabatkins commented 8 years ago

Yeah, that's what I'm intending by talking about how you'd have to opt-in the <var>s that denote parameters from the ones that are reffing values from elsewhere.

tobie commented 8 years ago

Want.

equalsJeffH commented 6 years ago

use case:

webauthn algorithm that returns an algorithm to credential management: https://w3c.github.io/webauthn/#createCredential

associated credential managment PR: https://github.com/w3c/webappsec-credential-management/pull/100

jyasskin commented 2 years ago

@camillelamy mentioned that this would be useful for her team's work.

In talking to @tabatkins about how to make it happen, they described the following list of sub-tasks:

  • [ ] defining a markup model for declaring algo args, along with types, and adding BS syntax making it ergonomic,
  • [ ] adding WebRef scraping for this info,
  • [ ] adding Bikeshed digestion of this info into a data file,
  • [ ] defining a markup model for invoking algos with args, and adding BS syntax to make it ergonomic,
  • [ ] checking invocations against the definitions we've obtained
samuelgoto commented 1 year ago

+1 as an interested user here!