bikeshed icon indicating copy to clipboard operation
bikeshed copied to clipboard

Inference of `function` type and functional `type`

Open cdoublev opened this issue 6 months ago • 0 comments

It seems that a function and functional type (ending with ()>) cannot be inferred (does it end with ()? Is it surrounded by <>?), according to the result from processing the source below with (the online version of) Bikeshed:

<pre class=metadata>
Title: Test
Status: DREAM
ED: https://api.csswg.org/bikeshed/
Shortname: test
Level: 1
Editor: me
Abstract: Bikeshed test.
</pre>

<pre class="prod def">
  <dfn>inferred-fn()</dfn> <!-- unexpected: data-dfn-type is "dfn" instead of "function" whereas it ends with () -->
</pre>
<pre class="prod def">
  <dfn function>explicit-fn()</dfn>
  <dfn>&lt;type-a></dfn> = <<explicit-fn()>>
  <dfn>&lt;type-b></dfn> = ''explicit-fn()'' <!-- type is "maybe" -->
</pre>
<pre class="prod def">
  <dfn>&lt;inferred-type()></dfn> <!-- unexpected: data-dfn-type is "dfn" instead of "type" whereas it is surrounded by <> -->
</pre>
<pre class="prod def">
  <dfn type>&lt;explicit-type()></dfn>
  <dfn>&lt;type-c></dfn> = <<explicit-type()>> <!-- LINK ERROR (no ref) -->
  <dfn>&lt;type-d></dfn> = ''<<explicit-type()>>'' <!-- no link is created -->
</pre>

As commented in the source, not being able to link to a functional type (because <<fn()>> always links to a function) seems problematic. For example, in CSS Mixins (source):

<dfn><<css-type>></dfn> = <<syntax-component>> | <<type()>>
<dfn>&lt;type()></dfn> = type( <<syntax>> )

<<type()>> does not link to the type definition on the next line, but to the (inlined) function in CSS Images 4.

If I remember correctly and understood correctly, function exists to avoid a name collision between value and value(). But I do not see why we could not link to a function using ''value()'' rather than <<value()>>, nor why function and functional type could not be inferred as expected.

cdoublev avatar Aug 07 '24 13:08 cdoublev