You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comment by corona10 Friday Apr 28, 2017 at 15:51 GMT
I have one thing to discuss here.
At this point, I think that we should create module directory for these kinds of task. runtime/sysmodule.go => module/sysmodule.go
WDYT? @trotterdylan@alanjds
Comment by trotterdylan Saturday Apr 29, 2017 at 23:28 GMT
I would avoid __getattribute__ and instead use __getattr__. The latter is called only after nothing is found through normal attribute lookup, which is probably what we want in this case.
Comment by alanjds Saturday Jun 10, 2017 at 15:48 GMT
I would avoid getattribute and instead use getattr. The latter is called only after nothing is found through normal attribute lookup, which is probably what we want in this case.
@trotterdylan Are you ok with going on this way, and allow to use getattribute for now, or is better to go develop getattr before keep going on this PR?
Comment by trotterdylan Wednesday Jun 14, 2017 at 14:35 GMT
I think that __getattr__ should be fairly straightforward to implement. It needs a new slot and fallback logic in grumpy.GetAttr(). Also a few tests that validate the correct attribute resolution.
Comment by trotterdylan Monday Jun 19, 2017 at 15:05 GMT
I think this is a little more complicated than I had hoped it would be. What if we get rid of the hybrid module concept and instead swap out sys.__dict__ something like this:
# lib/sys.py
from __go__.grumpy import SysDict, SysModules
SysModules['sys'].__dict__ = SysDict
... carry on with the module as normal
Currently __dict__ is not settable, but it will be once google#331 is merged.
Comment by trotterdylan Monday Jun 19, 2017 at 19:58 GMT
Right, so the trick would be get rid of the Stdout, Stdin and Stderr grumpy package members and instead pull those from SysDict like SysDict.GetItemString(f, "stdin"). I have a change started to see how this would work in practice. I can either finish that up and create a PR, or if you like, you can go that route in this PR.
Seems to still need an [SysDict[k] = locals()[k] for k in all] at the last line, but for me it looks more ok than the HybridModule stuff.
I don't think this is necessary if we do the __dict__ assignment at the very top of the module.
Activity
alanjds commentedon Oct 6, 2018
Friday Apr 28, 2017 at 15:51 GMT
I have one thing to discuss here.
At this point, I think that we should create
moduledirectory for these kinds of task.runtime/sysmodule.go=>module/sysmodule.goWDYT? @trotterdylan @alanjds
alanjds commentedon Oct 6, 2018
Friday Apr 28, 2017 at 16:25 GMT
I totally agree, but am not mature enough on Golang to glance the implications of this change.
alanjds commentedon Oct 6, 2018
Friday Apr 28, 2017 at 16:27 GMT
I believe that more modules will be needed. e.g (socketModule etc..)
alanjds commentedon Oct 6, 2018
Saturday Apr 29, 2017 at 20:55 GMT
This is no more a WIP, after changed from
__getattr__to__getattribute__fixed it.Will continue the google#290 implementation over this code.
Please discuss what changes we want before this (#70) got be merged.
alanjds commentedon Oct 6, 2018
Saturday Apr 29, 2017 at 23:28 GMT
I would avoid __getattribute__ and instead use __getattr__. The latter is called only after nothing is found through normal attribute lookup, which is probably what we want in this case.
alanjds commentedon Oct 6, 2018
Sunday Apr 30, 2017 at 01:48 GMT
Me too. But this rabbit hole is getting too deep!
Let me close some Print() issues first and later I come back to implement
__getattr__.This
__getattr__issue seems at least one magnitude harder than the other issues anyway. I will need to get "slots" understanding first.alanjds commentedon Oct 6, 2018
Monday May 01, 2017 at 19:00 GMT
Just to say, tracebacks would be very nice. Took me quite a bit to realize this 'res' typo
alanjds commentedon Oct 6, 2018
Saturday Jun 10, 2017 at 15:48 GMT
@trotterdylan Are you ok with going on this way, and allow to use getattribute for now, or is better to go develop getattr before keep going on this PR?
alanjds commentedon Oct 6, 2018
Wednesday Jun 14, 2017 at 14:35 GMT
I think that __getattr__ should be fairly straightforward to implement. It needs a new slot and fallback logic in grumpy.GetAttr(). Also a few tests that validate the correct attribute resolution.
alanjds commentedon Oct 6, 2018
Friday Jun 16, 2017 at 16:40 GMT
Ok. Then I will chase __getattr__ on another PR.
Everything else is ok?
alanjds commentedon Oct 6, 2018
Monday Jun 19, 2017 at 15:05 GMT
I think this is a little more complicated than I had hoped it would be. What if we get rid of the hybrid module concept and instead swap out sys.__dict__ something like this:
Currently __dict__ is not settable, but it will be once google#331 is merged.
alanjds commentedon Oct 6, 2018
Monday Jun 19, 2017 at 18:46 GMT
Hum... the whole point of this PR is allow
sys.stdout = StringIO()to propagate toprint.If
SysModules['sys'].__dict__ = SysDictfixes this need and is simpler, lets do it!Seems to still need an
[SysDict[k] = locals()[k] for k in __all__]at the last line, but for me it looks more ok than the HybridModule stuff.alanjds commentedon Oct 6, 2018
Monday Jun 19, 2017 at 19:58 GMT
Right, so the trick would be get rid of the Stdout, Stdin and Stderr grumpy package members and instead pull those from SysDict like
SysDict.GetItemString(f, "stdin"). I have a change started to see how this would work in practice. I can either finish that up and create a PR, or if you like, you can go that route in this PR.I don't think this is necessary if we do the __dict__ assignment at the very top of the module.