Liste des Groupes | Revenir à cl c |
On 23/04/2025 19:43, bart wrote:
Why are you automatically sticking up for THEM and not ME?By the 500 such macro definitions, and the EXTENSIVE use of such macro invocations instead of functions, in a class of application I'm very familiar with.So you don't know. You guessed.
>
You don't have any idea /why/ the developers choose to use macros like this - you simply assume that because you have written an interpreter with little use of macros,I've written a million lines of code with little use of macros.
What your experience tells you is that is that it is /possible/ to implement a little virtual machine for a simple language without using C macros.
It tells you nothing about whether or not it is a good idea, because you have not tried it out for comparison. It tells you nothing about how best to implement Lua in C, because that is a very different language from your languages.The example I gave was from ADD; my language has ADD too! Except that Lua's ADD works between Ints and Floats (Floats only before 5.1?); mine works between Ints, Floats, Strings, Bignums and Sets.
It tells you nothing about the best structure for a core project written by multiple people, with extensions written by hundreds or thousands of people, and with many orders of magnitude more end users - because you just have a one-person language.You forgot the bit where I said I've been doing this since the 1980s, on a few languages of my own, both dynamic and statically typed. And I've looked at lots of others including their implementations.
And to cap it all, you (AFAIUI) don't even use C to implement any of this stuff - you use your own languages. (Those may well be a better choice than C for implementing virtual machines.)I did try C at one point. That didn't use macros either.
The way you could /know/ the best way to implement a Lua virtual machine in C would be to investigate if the Lua developers, or any other groups, have tried to implement the Lua VM in different ways and seen how well they work. Or you could find books or articles that discuss different ways of implementing VMs.Maybe /I/ should write a book or article instead!
There are perhaps a half-dozen basic ways of implementing language virtual machines. There are a very large number of interpreted or byte- coded languages. You have experience of implementing a couple of simple languages, for personal use, using either a strangely restricted subset of C or one of your own languages.How many interpreters do you think the developers of Lua have worked on? (And how many of those developers also devised and programmed its implemenation language?)
Les messages affichés proviennent d'usenet.