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

body-of, values-of, words-of should apply to events, images and gobs as well #829

Open
Siskin-Bot opened this issue Feb 15, 2020 · 1 comment
Assignees

Comments

@Siskin-Bot
Copy link
Collaborator

Siskin-Bot commented Feb 15, 2020

Submitted by: meijeru

these reflectors apply to ports and errors, which are comparable, object-like structures which are efficiently implemented.

this is nothing more (or less) than a plea for consistency and regularity in the language in this respect

with gobs, the reflectors should yield the "owner" word/value only if set; and they should yield at most one of the draw/text/etc. words and/or values, as a very efficient way of checking which one of the five is set, if any


Imported from: CureCode [ Version: alpha 54 Type: Wish Platform: All Category: n/a Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#829

Comments:

Rebolbot commented on May 18, 2009:

Submitted by: BrianH

There is only so much uniformity we can get, since different datatypes have different meanings. Even the existing reflectors don't apply to all of the types that other reflectors apply to. Still, let's give it a shot, limited to just the reflectors you mention.

None of the reflectors should apply to image! - images are not object-like or function-like. Even TO-BLOCK doesn't convert an image to a block, it just wraps it.

As for events and gobs, since REFLECT is an action these wouldn't necessarily hurt to support. It depends on whether we want to pretend that these types are object-like, the way we do with the map! type. They aren't a part of any-object! since they can't be bound, but neither is map!.


Rebolbot commented on May 18, 2009:

Submitted by: Carl

My comments:

Some datatypes are "pseudo-objects" that allow special selectors. For example, date! and time! allow date/year, date/month, etc.

It seems reasonable that some level of reflection regarding such selectors could be useful for debugging/IDE/educational reasons.

For example, if I want to know what selectors can be used on a date, a reflector could provide that information.


Rebolbot commented on Feb 16, 2010:

Submitted by: henrikmk

I'd say it's nearly essential to allow reflection on gob!s and event!s to figure out how VID3.4 is put together and for general exploration. Otherwise document the entire structure of gob! and event!.


Rebolbot mentioned this issue on Jan 12, 2016:
TO-OBJECT date! could make an object


Rebolbot added the Type.wish on Jan 12, 2016


@Oldes
Copy link
Owner

Oldes commented Apr 11, 2020

@meijeru so far I implemented words-of for date!:

>> words-of now
== [year month day time date zone hour minute second weekday yearday timezone utc julian]

Which works actually like a shortcut for: query/mode now none

I'm not sure if other reflector types (body-of, values-of, etc) should be implemented.
I was thinking that values-of date could be shortcut for:

>> query/mode now words-of now
== [2020 4 11 23:38:10 11-Apr-2020 2:00 23 38 10 6 102 2:00 11-Apr-2020/21:38:10 102]

but than I decided, that I don't want to add code for it, as it is better to exactly specify, what and in which order is wanted, like:

>> query/mode now [second: minute: hour:]
== [
    second: 57
    minute: 39
    hour: 23
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants