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

Prototypes #1

Open
TheBerkin opened this issue Oct 11, 2020 · 0 comments
Open

Prototypes #1

TheBerkin opened this issue Oct 11, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request prototypes Related to Rant prototypes stub Issue needs expansion

Comments

@TheBerkin
Copy link
Member

TheBerkin commented Oct 11, 2020

Add support for prototype functions to map objects for OOP workflows, custom access logic, etc.

This is a WIP issue for ongoing design work on prototypes.

Getting and setting prototypes

Map prototypes can be retrieved and assigned with [proto] and [set-proto] respectively:

<$myobj = @()>
<$myproto = @(proto-method = [?]{foo})>
[set-proto:<myobj>;<myproto>]
[proto:<myobj>] # [map(1)]

Prototype methods

Elements of a map's prototype act like elements of the owning map.

<$myobj = @()>
<$myproto = @()>

[$myobj/test] { foo }
[$myproto/test] { bar }

[set-proto: <myobj>; <myproto>]

[myobj/test] # bar
@TheBerkin TheBerkin self-assigned this Oct 11, 2020
@TheBerkin TheBerkin added enhancement New feature or request prototypes Related to Rant prototypes labels Oct 11, 2020
@TheBerkin TheBerkin added the stub Issue needs expansion label Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prototypes Related to Rant prototypes stub Issue needs expansion
Projects
None yet
Development

No branches or pull requests

1 participant