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

Implement an optional mirror module. #1006

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

Conversation

mhermier
Copy link
Contributor

@mhermier mhermier commented May 4, 2021

An attempt at implementing #1004, using a mirror module.

Not yet ready for merge.

@joshgoebel
Copy link

joshgoebel commented May 4, 2021

Thought: Might be easier to review/read the changes if all the makefile auto-built changes weren't also included?

@mhermier
Copy link
Contributor Author

mhermier commented May 4, 2021

Yes and no.

First patch is an utility patch, second patch is the core of the patch, and third one is the premake update in isolation.
If one want to review, the first one will hardly change, and the effort should be concentrated on the second one.
premake update is required because of the new module. At best it is a reminder, and at worse an argument against having generated files in the git in the first place.

And personally, while I understand the motivations behind the inclusion of the generated files, their inclusion is a huge pain as it creates a fragmentation for contributions. I never know how to push changes that impacts premake generated files, because of differences between official and my local premake versions, and the fact it is required for the project build.

@joshgoebel
Copy link

Ah, true your commit history is indeed very clean. That's not always the case (in general - perhaps it's better here in Wren) and I'm just so accustomed to using "Files changed" for reviews. :-)

Agree entirely with the "huge pain" comment... although it was a small pain to get the correct version of premake installed (it doesn't seem to be updated in homebrew), so I also see it as a mixed blessing/curse. Wish I had a suggestion.

@mhermier
Copy link
Contributor Author

mhermier commented May 4, 2021

Ignoring some changes that I developed in separated branches that I don't consider urgent for inclusion, my main branch is +200 patch ahead of main. So I'm "forced" to tidy my changes, so (check) rebasing is as seamless as possible.

@mhermier
Copy link
Contributor Author

mhermier commented May 4, 2021

Fixed a some issues I noticed. added patch to access Class attributes from ClassMirror.

@mhermier
Copy link
Contributor Author

mhermier commented May 4, 2021

Arff changed my mind, will have to have a minimal layer of MethodMirror support to provide access to attributes.

@ChayimFriedman2
Copy link
Contributor

Since we don't expose setSlot(), I don't think we should rename it.

And I still think we should put it in the meta module: reflection is some kind of metaprogramming, too. And I don't see a reason to exclude one but not both.

Also, before we merge this PR, I think we need to have some way to actually invoke methods. I have some ideas, and would like to think about it a bit more.

Finally, what's the purpose of MethodMirror? It's not used at all!

@mhermier
Copy link
Contributor Author

mhermier commented May 4, 2021 via email

@ruby0x1 ruby0x1 marked this pull request as draft May 4, 2021 22:08
@mhermier mhermier force-pushed the mirror branch 4 times, most recently from 4ac3196 to c8edbb5 Compare May 18, 2021 13:45
@joshgoebel
Copy link

The classMirror that's commented out on methodMirror would be super helpful, I'm trying to get a bit more detail in my stack traces akin to Node (showing both the class and function):

      at Object.toEqual (rna-transcription.spec.js:17:24)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

@mhermier
Copy link
Contributor Author

While I agree, for now it is not possible because there is no pointer from the method to the class. I have to look how it impacts the vm.

@joshgoebel
Copy link

Screen Shot 2021-05-20 at 5 48 45 PM

What your code makes possible. :)

@joshgoebel
Copy link

The only thing I needed to add:

class StackTrace {
  frames { _stackTrace } // added

For accessing the raw frames so you can process them however you may want.

@mhermier
Copy link
Contributor Author

I have to think about that, because that way you can alter the stack trace, which is what I wanted to forbid.

@joshgoebel
Copy link

So why not?

frames { _stackTrace[0..-1] }

@mhermier
Copy link
Contributor Author

Was more thinking at making it a readonly list like container.

@joshgoebel
Copy link

joshgoebel commented May 20, 2021

To me it's just a list of items... once I have it I should be able to alter it, remove items, insert new items, it's MY list.. as long as I have a copy and I'm not messing with the canonical version or something bad.

@mhermier mhermier force-pushed the mirror branch 2 times, most recently from 4f1cb3e to 6157db1 Compare May 21, 2021 06:14
@mhermier
Copy link
Contributor Author

I updated so you should be able to pull the class form the MethodMirror.
I also added a breaking change, that will trigger in debug mode when a Method is tried to be bound again.

For your last concern, you can do [].addAll( stackTrace ) so that it remains constant. But it raise the question of an ArrayedSequence abstraction that could be really useful here.

@mhermier
Copy link
Contributor Author

Avoid to update yet, I have some concerns about how MethodMirror works. I think I have to change the underlying data, to be based on a Class methodIndex pair, instead of direct Closure/Fn access, to be able to reference primitives.

@mhermier mhermier force-pushed the mirror branch 2 times, most recently from a22c940 to c7dbcd2 Compare March 31, 2023 11:14
@mhermier
Copy link
Contributor Author

Updated. Not final yet, but in better shape, and allows "MethodMirror" to perform calls (though it needs a little bit more security).

@mhermier
Copy link
Contributor Author

Silenced an issue, where method can be bound multiple times. While the grammar allow inner class definitions and the behavior is even tested, it is implemented incorrectly. For that behavior to be correct; the whole ObjFn should be duplicated and bound.

@mhermier
Copy link
Contributor Author

Fixed silenced issue thinko.

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

Successfully merging this pull request may close these issues.

3 participants