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

WISH: make map! <object> #165

Open
hiiamboris opened this issue Jul 24, 2024 · 0 comments
Open

WISH: make map! <object> #165

hiiamboris opened this issue Jul 24, 2024 · 0 comments

Comments

@hiiamboris
Copy link

While I agree with red/red#2338 reasoning that object->map conversion is dangerous, at the same time from time to time I have to go through the odd object->block->map route (which is also lossy atm), and I remember it was being requested by others.

The use case rests on these issues:

  • objects are not extensible
  • maps do not evaluate the spec

So by writing

map: to map! to block! object [
    func1: func [args] [body...]
    ...
]

I can create a set of functions (or objects with functions) that is safely extensible at runtime.

I've counted 8 occurrences of that in my code, and there's also sometimes a trick to make the spec more human-readable (but it's of low importance):
to map! to [] object [dec: sci: pct: none] instead of:
#[dec: #[none] sci: #[none] pct: #[none]]

Of course if we plan to make objects extensible, this would obsolete this wish.

@hiiamboris hiiamboris changed the title WISH: make object! <map> WISH: make map! <object> Aug 23, 2024
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

No branches or pull requests

1 participant