faster-cpython / ideas

1.69k stars 49 forks source link

Work out detailed rules for scopes and write a blog post about it #249

Open gvanrossum opened 2 years ago

gvanrossum commented 2 years ago

I've got the rules worked out, and some text and some Python code that describes them. I'd like to finish this up in the form of a blog post hosted on ~Medium (or elsewhere if Medium proves to be a problem)~ GitHub pages.

gramster commented 2 years ago

I personally am against the use of Medium; is there somewhere else you could post this? You could of course use our Python blog but I expect you'd prefer somewhere more neutral.

gvanrossum commented 2 years ago

Yeah, I just tried Medium after a long absence and found that it has turned into a junkyard. My current plan is to publish using my GitHub home page. I write in MarkDown and GitHub publishes decent HTML, which makes me happy.

gvanrossum commented 2 years ago

The blog will appear at https://gvanrossum.github.io/formal/scopesblog.html. (What's there now is incomplete.)

gvanrossum commented 2 years ago

I consider the text (and code) at https://gvanrossum.github.io/formal/scopesblog.html now basically complete. Have a look!

iritkatriel commented 2 years ago

You say LEGB, but the code of ClosedScope.lookup seems to be doing LGE(B)?

gvanrossum commented 2 years ago

@iritkatriel

You say LEGB, but the code of ClosedScope.lookup seems to be doing LGE(B)?

name in self.globals is true iff there's a global <name> declaration in the scope.

gvanrossum commented 2 years ago

I consider this done. On to code generation and execution.

oraluben commented 2 years ago

@gvanrossum Thanks for the blog! I've found a trivial markdown syntax issue near "hoops" at https://github.com/gvanrossum/gvanrossum.github.io/blob/876b4b89a3b715a05e95165135556e79f9c3db55/formal/scopesblog.md?plain=1#L53