Elektrine lite

← Feed

@schwa@mastodon.social

Post #2133175

2026-05-05 21:58 UTC

I'd love a swift closure decorator that prevented you from writing to any other variable apart from the ones passed into the closure…

Replies (6)

  • @dlx@mastodon.social 2026-05-05 22:06

    @schwa@mastodon.social @convention(c)? :thinkhappy:

    Open ##2394313

  • @mipstian@mas.to 2026-05-05 22:17

    @schwa@mastodon.social it comes up as pitches periodically (https://forums.swift.org/search?context=topic&context_id=5217&q=pure%20functions&skip_context=true) but I don’t think it ever made it to the proposal stage

    Open ##2394314

  • @ryanbooker@mastodon.social 2026-05-05 22:22

    @schwa@mastodon.social honestly I’d like to be able to force everything to be pure.

    Open ##2394317

  • @Gte@mastodon.social 2026-05-05 22:33

    @schwa@mastodon.social I’d love to limit _reads_ but that’s super impractical. (The usage is in things like a builder where I want to prevent people consulting app state when I’m asking them to build things with the state I’ve provided to the closure)

    Open ##2394319

  • @schwa@mastodon.social Like a broadly-typed Span? Edit: read my own link. I suppose you could type a Span. Ex: `Span`. But maybe Span isn’t exactly what you’re looking for. https://developer.apple.com/documentation/swift/span

    Open ##2394321

  • @schwa@mastodon.social @convention(thin), which I believe is at least partially implemented https://forums.swift.org/t/convention-thin-function-pointers/65180

    Open ##2394323