aarroyoc / mipsie

MIPSie (Prolog MIPS emulator)
5 stars 0 forks source link

Make code more portable by using the Logtalk `dictionaries` and `format` libraries #1

Open pmoura opened 2 years ago

pmoura commented 2 years ago

The source code can be made more portable by replacing the use of the assoc module library by the Logtalk dictionaries library and replacing the use of the format module by the Logtalk format library. If you agree these changes are beneficial, I'm happy to help (e.g. via pull requests).

aarroyoc commented 2 years ago

Thanks for your help! Actually, I'm going to ask you to not send any PR because this is my project for learning Logtalk in a more-than-toy codebase and I'd like to improve it myself when I find some free time. But, any kind of suggestion is welcome!

pmoura commented 2 years ago

One question: why the messages to self in the registers object? Do you expect to extend this object and redefine the value/3 predicate?

aarroyoc commented 2 years ago

Hmm, actually I don't know why. Now that you're asking that, I suppose that there's a difference between ::value and value.

pmoura commented 2 years ago

In this specific case, with the code as-is currently, the end results are the same but not the performance as ::/1 is a message-sending control construct that necessarily uses dynamic binding (as self is only know at runtime); calling value/3 directly is faster as it's just a call to a locally defined predicate with no need for lookups.