WingedSeal / jmc

A compiler for JMC (JavaScript-like Minecraft Function), a mcfunction extension language for making Minecraft Datapack
https://jmc.wingedseal.com
MIT License
65 stars 10 forks source link

Add a dedicated "this" keyword for classes #45

Closed w00tyd00d closed 11 months ago

w00tyd00d commented 1 year ago

Description

The addition of a dedicated this keyword could be used as a means to access the currently accessed "class" address when writing classes in JMC.

For example, instead of having to write this:

image

You could just write it like this:

image

Nico314159 commented 1 year ago

+1

WingedSeal commented 11 months ago

Do realize that this little suggestion of yours caused me pain and suffering by passing the class through branches of complex function down to where jmc function called is used hence needed. I suffered typing the word "prefix" 94 TIMES scattered throughout the entire jmc code base. And I hate you for that. Pass prefix(class) through everything down to function call 11 files changed, 94 insertions(+), 82 deletions(-)

https://github.com/WingedSeal/jmc/commit/0d824337b4421d8603572ffcee749c7d88b704d8

WingedSeal commented 11 months ago

https://github.com/WingedSeal/jmc/commit/0d824337b4421d8603572ffcee749c7d88b704d8 https://github.com/WingedSeal/jmc/commit/2920d3378c4b2c5d461eaf360c13c072f1f493d6 https://github.com/WingedSeal/jmc/commit/905ccf06fd52ada52a552d3ba6e10f56a91fec86 Add a dedicated this keyword for classes