Included are a couple examples, like a JSON parser and a simple 6502 compiler. I have also written a small wiki, that showcases how to use the included containers: https://github.com/glouw/ctl/wiki
Included are a couple examples, like a JSON parser and a simple 6502 compiler. I have also written a small wiki, that showcases how to use the included containers: https://github.com/glouw/ctl/wiki
Many things have exactly one correctly spelled full name, but many alternative contractions or cute variations.
Programmers can be expected to know the correct spelling of "vector" or "dequeue". They can't be expected to know your specific contraction or abbreviation of it. They can't guess and they're not mind readers. They have a muscle memory that has them type out the full word automatically, without thinking.
Don't break these expectations.
Yes.
https://www.npmjs.com/package/dequeue
https://api.jquery.com/dequeue/
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.queue-1.dequeue?view=net-5.0https://doc.rust-lang.org/std/collections/struct.VecDeque.ht...
EQ/EQL/EQUAL/EQUALP, PROCLAIM/DECLAIM/DECLARE, and the atrocious PAIRLIS (really??). And not to mention the fact that PAIRLIS returns an association list, which is entirely different from a "plist".
And then of course CAR, CDR, CADR, CDDR, et alia.
This is all second nature for an experienced Lisp programmer, but it makes for a difficult learning experience.
I hate this field so much. That anyone creative chooses willingly to go into software is a miracle. Are there people out their with pre-broken spirits, that want to join this soul-less galley of horrors? Starvation should be preferable to this. But i digress..
Why not make naming something that can be personalized? Make the variablename a sort of rule-based-building-block-lego-system, that can be adapted by the user.
Increment+Variable -> "upIndex" for you Increment+Variable -> "incVar" for me. Everyone is happy, the frameworks and apis only specify the buildingblocks as variableNames.. autotranslated variableNames, customized to everyones flavour.
Hooray, i contributed. Prolonging the nightmare.
I'm not sure which way is more popular. Paul Graham has mentioned in several essays how programmers are lazy and want to type the minimum number of characters possible. On the other hand Elon Musk has loudly complained about acronyms and contractions.
In the end you can't please everyone, so the developer just has to pick a style and go with it. If you dislike the short names, it's easy enough to put a comment above the template instantiation explaining what's going on.
Not as elegant as some IDEs I'm sure, but if typing is stopping you from using longer names, this could help.
I do actually agree on the primitive vs p thing though...
(I have worked on code where the debug print macro was called P...)
As for your pqueue implementation, the efficacy of an optimizing compiler lies in the inherent complexity of the language. I can imagine the optimization backend for gcc is simpler (and more effective) than g++, but I am not an expert on compiler internals.
And I've written similar things myself (hash table and vectors).
I wanted a good hash map, so I spend a lot of time comparing them. There are like 10 separate map implementation in FreePascal, but they are all slower than C++'s std::unordered_map.
Then I compared another dozen of libraries, and found the fastest one that is like 50% faster than std::unordered_map. But it was a rather straight forward implementation of non-linear open addressing.
See the comment and following 4 macros for how this would work with a (add-only, not growable) hashmap:
https://github.com/matvore/nusort/blob/master/src/util.h#L16...
Being stuck with C++ I did something in reverse - ported C-style ("intrusive") containers to ++, making them a bit safer to use, but keeping the syntax nearly the same.
https://github.com/apankrat/notes/tree/master/intrusive-cont...
https://www.boost.org/doc/libs/1_75_0/doc/html/intrusive.htm...
Have you considered it? Is it deficient for your use case?
"the goal here is to make a better version of C-style containers rather than to implement something C++-style and similar,"?
But a goal is not a reason. I.e. why doing
CONTAINER_OF( user_data, vip );
instead of container_of<&user_data::vip> vip_list;
is preferable? How are they even meaningfully different?As to why to do what you wrote I have no idea. These two code snippets are unrelated.
If I were to pick the reason, it'd be simply that I don't like Boost.
To me, Boost is an ultimate embodiment of all that went wrong with C++ when it evolved from being a better version of C into the multi-paradigm monstrosity that it is now. Just look at the man page linked above. How to get a clever little concept of intrusive containers and completely decimate it into a technically correct, but unpalatable formulistic piece of engineering that, above all else, is rid of any shred of elegance that made the original concept so great in the first place.
It will also take up more space, to store that very pointer.
All of which starts to matter (a lot) when operating with very large data sets.
Among other implications (different memory locality and allocation guarantees), you could have the same intrusive node object used in several container objects or even classes (though not at the same time). That is, pull an element from a doubly linked list and insert it into a binary tree without reallocation.
With std::list you need to find the iterate to the node before you can delete it.
Did you also run tests against other libraries such as glib?