Skip to content

Conversation

@syg
Copy link
Contributor

@syg syg commented Sep 16, 2021

This PR adds support for the effects <dt> key to the AO structured header. The corresponding <dd> is a comma-separated list of strings.

The list of effects are propagated to all clauses that have an Xref to (i.e. users of) the AO with the effect, transitively. Some effects are runtime-only and do not propagate to static SDOs. Currently, only user-code (i.e. "can call user code") is included in that list.

During autolinking, linked AOs and SDOs that are invocations (current supported styles are AO() and SDO of) with effects get the effect names as class names prefixed with e- on the <a> tag. For example, if a link to an AO has the user-code "can call user code" effect, links to it would include the class e-user-code in applicable contexts. For user-code, since that only applies at runtime, that class doesn't appear in links within static SDO clauses.

Since the propagation of effects is conservative, there may be false positives. The list of effects may be suppressed with the <emu-meta> tag around the AO invocation: <emu-meta suppress-effects="user-code">AOName()</emu-meta>.

@syg syg force-pushed the can-call-user-code branch from b5387cd to 653cb12 Compare September 16, 2021 00:34
@syg
Copy link
Contributor Author

syg commented Sep 16, 2021

Forgot to add that there is preliminary styling for e-uc, which can be toggled with the u key.

@syg syg requested a review from bakkot September 16, 2021 00:38
@jmdyck
Copy link
Contributor

jmdyck commented Sep 16, 2021

"uc" seems rather cryptic. Does the effect name have to be so short?

The list of effects may be overridden with the tag around the AO name

In an invocation, you mean?

@syg
Copy link
Contributor Author

syg commented Sep 16, 2021

"uc" seems rather cryptic. Does the effect name have to be so short?

Nope, I'm open to any name here. Originally it was 'can-call-user-code' which was kind of long.

In an invocation, you mean?

Yes, exactly.

@syg
Copy link
Contributor Author

syg commented Sep 16, 2021

Also to be clear, I'm not wedded to the way "UC" is styled right now, it's just what I was using to test.

@bakkot
Copy link
Member

bakkot commented Sep 26, 2021

Looks reasonable at a glance, though we should sort out whether we're going to take generic a generic "effects" attribute or to have a concrete list.

Also needs tests/docs, which I can get to at some point if @syg doesn't.

@syg syg force-pushed the can-call-user-code branch from 9cf3ce1 to 6164fa9 Compare September 30, 2021 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants