Skip to content

Code position effect#1357

Closed
marzipankaiser wants to merge 11 commits intomainfrom
feature/codepos-effect
Closed

Code position effect#1357
marzipankaiser wants to merge 11 commits intomainfrom
feature/codepos-effect

Conversation

@marzipankaiser
Copy link
Copy Markdown
Contributor

@marzipankaiser marzipankaiser commented Apr 8, 2026

This allows functions (and effects etc) to require a codepos effect from their context, which is implicitly handled at each call site of such a function and returns a unique string for that call site.

This is (ab-)using effects for something similar to the implicit parameters in

Daan Leijen, Tim Whiting: Syntactic Implicit Parameters with Static Overloading

@marzipankaiser marzipankaiser added feature New feature or request area:typer experiment Experimental branch, do not merge! labels Apr 8, 2026
@marzipankaiser marzipankaiser changed the title [Experiment] Codeposition effect [Experiment] Code position effect Apr 8, 2026
@marzipankaiser marzipankaiser force-pushed the feature/codepos-effect branch from 7c8d3f7 to d99d596 Compare April 8, 2026 11:39
@marzipankaiser
Copy link
Copy Markdown
Contributor Author

This now has the following (rough) semantics:

  • If a function has a codepos effect, it is implicitly handled at the callsite by returning a constant String
    • except if it is in a context where codepos is handled already, i.e.:
      • in a try { .... } with codepos {...}
      • in a def ... : ... / { ..., codepos, ... } =
      • in a higher-order function call that handles codepos

This allows "forwarding" the code position to helper functions easily.

@marzipankaiser marzipankaiser changed the title [Experiment] Code position effect Code position effect Apr 8, 2026
@marzipankaiser marzipankaiser removed area:typer experiment Experimental branch, do not merge! labels Apr 8, 2026
@marzipankaiser marzipankaiser marked this pull request as ready for review April 8, 2026 12:59
@marzipankaiser marzipankaiser added the experiment Experimental branch, do not merge! label Apr 14, 2026
@marzipankaiser
Copy link
Copy Markdown
Contributor Author

Superseded by #1380 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experiment Experimental branch, do not merge! feature New feature or request requires-design

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant