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

Calling an OP one has made oneself gives strange error #1052

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

Calling an OP one has made oneself gives strange error #1052

Siskin-Bot opened this issue Feb 15, 2020 · 1 comment
Labels
CC.resolved Issue with CureCode status built, tested or complete Datatype: function! Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Status.important Test.written Type.bug

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: meijeru

See #1051, and the code hereunder.

>> o: make op! [[][]]
== op!
>> 1 o 2
** Script error: invalid argument: %.bmp

Imported from: CureCode [ Version: alpha 66 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 67 ]
Imported from: metaeducation#1052

Comments:

Rebolbot commented on Jul 6, 2009:

Submitted by: BrianH

The error is that make op! [[][]] works at all - it should throw an error.

The OP function should be the only way to create a value of that type. If the MAKE action works badly with this specs, then trial and error would eventually lead to specs that work, which would allow recreation of these functions in REBOL code when they are otherwise intentionally inaccessible. This would be a major security hole.

As it is, the behavior of the make action of this types suggests that the resulting function accesses memory badly. This is a worse situation than #1051, where at least the function crashes REBOL. Here, you are apparently able to successfully access a value in memory that doesn't crash the interpreter right away. This means that this is a potential security hole with this spec, let alone some theoretical other spec not yet found.


Rebolbot commented on Jul 6, 2009:

Submitted by: Carl

For 3.0.0 - MAKE of op! will now throw an error. However, R3 has been designed to allow user-defined ops... but that feature will be deferred until a future release.


Rebolbot commented on Jul 6, 2009:

Submitted by: BrianH

The OP function should be good for making user-defined ops when that feature comes. Is it intended that the function redirected to must be of the action! type, as it is for all current ops?


Rebolbot added Type.bug and Status.important on Jan 12, 2016


Hostilefork added on Jan 24, 2018


Hostilefork commented on Jan 24, 2018:

Make OP! does not appear to raise an error in R3-Alpha open source release, and gives the error shown.
Ren-C has changed this completely and has a full means for specifying functions that acquire their argument from the left. There is no OP! (there is only one FUNCTION! type overall), however that function may be associated with a word in SET via an ENFIX binding. This has yielded some very interesting results.


Oldes added a commit to Oldes/Rebol3 that referenced this issue on Apr 29, 2019:
FIX: Calling an action made by oneself crashes R3


Oldes added a commit to Oldes/Rebol3 that referenced this issue Apr 3, 2020
I'm not much fun of _ops_, but now it's possible to do code like:
```
>> .: make op! [[a b][ join a b ]]
>> "a"."b".(random 10)
== "ab1"
```

Current limitation is, that there is no runtime check of first argument's type!

Related to: Oldes/Rebol-issues#1052
@Oldes Oldes mentioned this issue Apr 3, 2020
@Oldes
Copy link
Owner

Oldes commented Apr 3, 2020

>> .: make op! [[][]]
** Script error: cannot MAKE/TO op! from: [[] []]
** Where: make
** Near: make op! [[] []]

>> .: make op! [[a b][join a b]]
>> "a"."b"
== "ab"

@Oldes Oldes closed this as completed Apr 3, 2020
@Siskin-Bot Siskin-Bot added the CC.resolved Issue with CureCode status built, tested or complete label May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CC.resolved Issue with CureCode status built, tested or complete Datatype: function! Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Status.important Test.written Type.bug
Projects
None yet
Development

No branches or pull requests

2 participants