Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move semantics #190

Closed
andrewrk opened this issue Sep 14, 2016 · 2 comments
Closed

move semantics #190

andrewrk opened this issue Sep 14, 2016 · 2 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.

Comments

@andrewrk
Copy link
Member

Let's say we have a non-copyable List data structure (current implementation in std matches this because of the prealloc_data field).

// non-copyable
struct List { ... }

struct Buffer {
    data: List(u8),
}

struct Token {
    name: Buffer,
}

struct CompletedTokenization {
    tokens: List(Token),
}

List(Token) is (not currently but should be) a compile error because the list implementation calls realloc on T which copies the data. And List itself is non-copyable, so that bubbles up and means you can't have tokens: List(Token).

  1. Make this a compile error.
  2. Should we specify move semantics so that this can actually be allowed and work correctly?
@andrewrk andrewrk added the enhancement Solving this issue will likely involve adding new logic or components to the codebase. label Sep 14, 2016
@pavildon
Copy link
Contributor

may be not related but: any plans to make object lifetimes accesible in some way to templates so they can be compared at compile time? (ie, if an object can outlive me ('a<'b) i can not share a resource) (ala A' / B' on rust) IMO if this feature is implemented should be optional. as introduces too much noise in the templates definitions

@andrewrk
Copy link
Member Author

andrewrk commented May 7, 2017

Closing in favor of #287

@andrewrk andrewrk closed this as completed May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

No branches or pull requests

2 participants