lisdude / toaststunt

A network accessible, multi-user, programmable, interactive system for the creation of LambdaMOO style MOOs / MUDs.
63 stars 26 forks source link

Seaking an experienced eye over additional prepositions and modernising the MOO language to support compound assignment #82

Closed NathanTech7713 closed 1 year ago

NathanTech7713 commented 1 year ago

Hello,

So the latter, compound assignment operators, is something I've been really interested in for some time. It is surprising that it seems to take a back seat in moo especially as they are pretty well standard in modern languages, even not so modern if I am honest.

If I understand things correctly (probably not) this would be modifications of code_gen.cc and disassemble.cc?

The second question for that ties into the second subject, additional prepositions. As far as I can find the only place the list of prepositions supported by the server is in db_verbs.cc. There are some missing from this list, for example, behind, amongst etc. Use cases: Hide behind door put cat amongst pidgins. I realise this can largely be managed with verb args of any any any and then doing a syntax check there, and likewise probably something can be lifted to use regexp for the compound assignment within the moo itself, but primarily, for both of tese I was wondering if there was a design reason to leave these out?

Thanks

tvdijen commented 1 year ago

So the latter, compound assignment operators, is something I've been really interested in for some time. It is surprising that it seems to take a back seat in moo especially as they are pretty well standard in modern languages, even not so modern if I am honest.

If I understand things correctly (probably not) this would be modifications of code_gen.cc and disassemble.cc?

I think it would also require work on the parser.y file. I remember from the old days there was a patch for the classic LambdaMOO that would allow you to write x += 1 in MOO-code and then it would be parsed into x = x + 1 before it would be compiled into BYTECODE, but I can't seem to find it anymore.

I realise this can largely be managed with verb args of any any any and then doing a syntax check there, and likewise probably something can be lifted to use regexp for the compound assignment within the moo itself, but primarily, for both of tese I was wondering if there was a design reason to leave these out?

I used to add some too.. It shouldn't be a problem as long as you append them to the end of the list. See warning in db_verbs.cc

NathanTech7713 commented 1 year ago

there was a patch for the classic LambdaMOO that would allow you to write x += 1 in MOO-code and then it would be parsed into x = x + 1 before it would be compiled into BYTECODE

Yeah! I thought I remembered this too! I should start building a compilation of these, I have a few floating around... Old patches that is, not that they're of much use these days other than as a study piece, but some of the old goodies seem to fade away day by day.

Good to know on the prep front, glad I was not missing anything there.

I did some further reading and have somewhat revised my opinion of files, I think I'm still on the right track with code_gen.cc, but am leaning towards ast.cc and unparse.

See I thought parser.y too, but that deals more with slots than anything, from what I can see EG OBJ, FLOAT etc.

tvdijen commented 1 year ago

There's at least these where you can find some old stuff:

I've found an old patch that also changes some aspects of the language that may guide as a reference to what files are involved. See attachment scattered_for_stunt.patch

distantorigin commented 1 year ago

We are not currently looking to change the semantics of the MOO language as it stands in the current iteration of the server. You may consider using one of the aforementioned patches on your own version, or using a fork.

Please open a separate issue for additional prepositions.