Make peg-grammar available in all threads for peg/compile#1703
Make peg-grammar available in all threads for peg/compile#1703bakpakin merged 1 commit intojanet-lang:masterfrom
Conversation
Perhaps you wouldn't mind indicating the specifics? |
|
Ouch. I discovered that bakpakin replaced I was careless in monkey mode. |
|
Thanks for the details. Errors happen. No harm done. |
|
FWIW, according to the commit message for 85155bb, the change in question was allegedly part of activity supporting this endeavor. Note that this change has been in place for just about 5 years (from 2021-01-24). |
|
Perhaps, default-peg-grammar should become immutable? You can change |
|
@bakpakin Should
It seems to me that you don't really need to modify default-peg-grammar during runtime.... In practice, people just want the default. If people wanted more shared grammar, then they can carry it outside default-peg-grammar. This is also certainly more functional and referentially transparent. I decrease complexity by sticking to referential transparency unless I have to deviate from it. Or, perhaps this pull request is good enough because most small scripts don't launch a new thread.... |
|
There was some concern originally about accidentally pulling in the entire core library just to compile PEGs, but I think that is not a realistic problem for most users - the current architecture was originally done to decouple Pegs from core. There are plenty of ways to optimize this but I think this is the simplest solution for now. |
FWIW, I've added to |
|
Hmm, I just realized some other issues with this change, perhaps I merged too soon. Let me test some stuff locally, but I think may want to revert this. Sorry @amano-kenji |
It fixes #1180.
Although I don't know how to write C, who knew the pull request is going to be easy for a person who knows almost nothing about C? Today, I'm your code monkey who types shakespeare. The code monkey God gave me an insight for this pull request.
I tested it with
which prints
Your code monkey also found that sogaiu replaced
default-peg-grammarwith(dyn :peg-grammar). This change broke peg/compile.