Skip to content

Language support for BufferView#2103

Closed
atrick wants to merge 1 commit intoswiftlang:mainfrom
atrick:bufferview-roadmap
Closed

Language support for BufferView#2103
atrick wants to merge 1 commit intoswiftlang:mainfrom
atrick:bufferview-roadmap

Conversation

@atrick
Copy link
Copy Markdown
Contributor

@atrick atrick commented Jul 13, 2023

This roadmap discusses the language and compiler features required to implement a "BufferView" type in Swift. Non-copyable and non-escaping types provide the language foundation for BufferView. These new type constraints provide stronger guarantees about the ownership and lifetime of their values. Such guarantees make it possible to design safe, efficient libraries based on a "container/view" programming pattern. Although, we expect this programming pattern to be broadly applicable, BufferView is a particularly important use case because Swift developers need safe and efficient views over a container's contiguously stored memory.

@atrick atrick force-pushed the bufferview-roadmap branch 3 times, most recently from be91e94 to d88541f Compare July 14, 2023 00:24
@atrick atrick requested review from glessard, jckarter and rjmccall July 14, 2023 00:30
@atrick atrick force-pushed the bufferview-roadmap branch from d88541f to f298f54 Compare July 14, 2023 00:48
@benrimmington
Copy link
Copy Markdown
Contributor

benrimmington commented Jul 14, 2023

The roadmap uses "non-escaping" rather than "non-escapable".
Should the constraint be ~Escaping rather than ~Escapable?
(This is also consistent with the attribute for @escaping closures.)

@atrick atrick force-pushed the bufferview-roadmap branch from f298f54 to 491cb58 Compare July 14, 2023 22:25
@atrick atrick changed the title BufferView Roadmap Language support for view types Jul 15, 2023
@atrick
Copy link
Copy Markdown
Contributor Author

atrick commented Jul 15, 2023

Should the constraint be ~Escaping rather than ~Escapable?

I don't have much of an opinion. I expect plenty of bike-shedding. It isn't set in stone until we have a formal evolution proposal. We'll keep updating this document in the meantime.

We regularly talk about non-escaping values, which relates to the context in which a value is used. When talking about types, I could start using the term non-escapable if that matters to people.

I do think we'll end up with ~Escapable syntax which is analogous to ~Copyable. This is preferable when talking about negating a capability of the type.

It seems pointless to change @escaping at this point. I'm fine with slightly different terminology for these things, which have slightly different semantics.

@atrick atrick force-pushed the bufferview-roadmap branch 2 times, most recently from 0bf243c to ab5a39a Compare July 17, 2023 19:28
@atrick atrick force-pushed the bufferview-roadmap branch from ab5a39a to 73936f2 Compare July 27, 2023 18:02
This roadmap discusses the language and compiler features required to
implement a "BufferView" type in Swift. Non-copyable and non-escaping
types provide the language foundation for BufferView. These new type
constraints provide stronger guarantees about the ownership and
lifetime of their values. Such guarantees make it possible to design
safe, efficient libraries based on a "container/view" programming
pattern. Although, we expect this programming pattern to be broadly
applicable, BufferView is a particularly important use case because
Swift developers need safe and efficient views over a container's
contiguously stored memory.
@atrick atrick force-pushed the bufferview-roadmap branch from 73936f2 to fd63292 Compare July 27, 2023 18:02
@atrick atrick changed the title Language support for view types Language support for BufferView Jul 27, 2023
@atrick
Copy link
Copy Markdown
Contributor Author

atrick commented Jul 27, 2023

Closing because this is a design exploration and roadmap for future proposals rather than a "vision" document. For future reference, refer back to the forum post.

@atrick atrick closed this Jul 27, 2023
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.

2 participants