Skip to content

Term.of and .asExprOf is confusing to new users, please add back seal/unseal #10685

Closed
@deusaquilus

Description

@deusaquilus

@nicolasstucki @lihaoyi I understand that changing seal/unseal to Term.of and .asExprOf makes sense internally, especially since it avoid the need for an extra call (i.e. in x.seal.cast[T]). For new users for Tasty Reflect however, the mental-model of "sealing" and "unsealing" is beautifully intuitive and makes the whole Term <-> Expr duality much, much easier to understand. Several students to whom I have taught Tasty-Reflect have told me this. Is there any possibility that the following could be added for user-convenience?

expr.unseal     // as a shortcut for Term.of(expr)
term.sealAs[T] // as a shortcut for term.asExprOf[T]
term.seal         // as a shortcut for term.asExprOf[Any]

Normally I would just add these things in my own codebase as extension classes but Quotes being a path-dependent variable makes this very difficult to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions