- Some classic (GoF) design patterns are no longer needed in C++ - 10 Updates
- C++ Boost Libraries - 2 Updates
- Simple Program from 2.3.2 of Stroustrup 3/e - 1 Update
- About morality - 1 Update
- Here is again Sir Flibble - 2 Updates
- Read again, i correct - 1 Update
- About the following algorithms - 4 Updates
- Read again Sir Flibble - 1 Update
- About Sir Flibble - 1 Update
- Read again... - 1 Update
- About my new algorithm - 1 Update
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 12 11:47PM On 12/01/2018 23:12, Chris Vine wrote: > OO credentials by reference to your role in bringing to market one of > the first mobile phones, for Siemens if I recall it correctly. I think > I described you as a 1990s OO dinosaur, or something like that. I was on the team that made the first smartphone but it wasn't Siemens and I would never "describe my OO credentials" in relation to that role as OO is but one tool in the toolbox so I still think you are confusing me with somebody else. It is certainly the case that I wouldn't have used std::function when working on that project as Boost wasn't available to us at the time for various reasons so we couldn't have used Boost.bind however that was a long time ago and I have been using "modern" C++ techniques for a considerable time since and I have been using std::function since TR1 support was added to the stdlib implementations I use. > If you weren't involved in Siemens mobile phones then I have got the > wrong person. Maybe you are confusing two different people as one person. > dispatch in OO-style is that you do it through a pointer to a base > class (usually abstract), which of necessity requires allocation on free > store of the concrete object implementing the abstract interface. "OO-style" (that terminology is awful btw) inheritance does NOT require allocation on the free store; all it requires is storage into which an allocation can be made and that can be on the free store, the stack or from a static storage duration memory pool. > specially designed small object allocator) when using the abstract > class/inheritance approach but not when using std::function, then you > may have a point. Dunno. What you call a "fancy allocator" I just call a (custom) allocator; nothing "fancy" about it. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 12 11:54PM On Fri, 12 Jan 2018 23:47:23 +0000 > require allocation on the free store; all it requires is storage into > which an allocation can be made and that can be on the free store, > the stack or from a static storage duration memory pool. You are quibbling. I hope it is obvious that by free store I meant some allocation by a heap-like allocator - that is, not on the stack. > > you may have a point. Dunno. > What you call a "fancy allocator" I just call a (custom) allocator; > nothing "fancy" about it. Quibbling. Your main point seems to have come down to "you cannot have custom allocators for std::function". That surprises me but you may be right about that. You could partially get around that by passing to std::function custom function objects instead of lambda expressions, and giving those a custom allocator. But I suspect std::function has its own strategies. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 13 12:27AM On 12/01/2018 23:54, Chris Vine wrote: >> the stack or from a static storage duration memory pool. > You are quibbling. I hope it is obvious that by free store I meant > some allocation by a heap-like allocator - that is, not on the stack. No I am not quibbling. You are wrong: it is quite possible to allocate these objects on the stack in fact it is as easy as: typedef std::shared_ptr<ICommand> command_ptr; // abstract command base typedef std::vector<command_ptr> macro; // chained commands int main() { RedoCommand cmd1; UndoCommand cmd2; macro m; m.push_back(command_ptr{command_ptr{}, &cmd1}); m.push_back(command_ptr{command_ptr{}, &cmd2}); use(m); // obviously lifetime of cmd1 and cmd1 must exceed lifetime of m // or anything that uses m as is the case here. } slightly more advanced: int main() { alignas(128) char storage[ARENA_SIZE]; stack_allocator sa{storage, sizeof(storage)}; macro m; m.push_back(std::allocate_shared<RedoCommand>(sa)); m.push_back(std::allocate_shared<UndoCommand>(sa)); use(m); } > to std::function custom function objects instead of lambda expressions, > and giving those a custom allocator. But I suspect std::function has > its own strategies. I suggest you look up the word "quibbling" in a dictionary because that is the second time you have used it inappropriately. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Christian Gollwitzer <auriocus@gmx.de>: Jan 13 08:46AM +0100 Am 12.01.18 um 20:42 schrieb Mr Flibble: > Some classic (GoF) design patterns are no longer needed in C++. > Lambdas wrapped by std::function, for example, can be used instead of > the "command" pattern. I fully agree. In fact, if you are used to a dynamic language (Python is popular these days), then most of these "design patterns" seem very baroque. std::function, lambdas, auto etc. bring modern C++ much closer to those dynamic languages and thus make these design patterns obsolete. There is a saying that "design patterns are actually defects of a language" https://stackoverflow.com/questions/1579162/are-design-patterns-really-language-weaknesses I think that these OO design patterns are actually a proof-of-concept, it shows that you can reduce all of these usage patterns to class hierarchies with virtual function calls, but it doesn't mean that you should actually do that, unless it is the only available option - like you can prove that pure lambda calculus or SK combinators have the same computational power as C++, but you wouldn't actually want to write code like that. Christian |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 13 09:29AM +0100 On 1/13/2018 8:46 AM, Christian Gollwitzer wrote: > popular these days), then most of these "design patterns" seem very > baroque. std::function, lambdas, auto etc. bring modern C++ much closer > to those dynamic languages and thus make these design patterns obsolete. A main feature of the (original) command pattern is support for undo functionality. I fail to see how `std::function` does that. > There is a saying that "design patterns are actually defects of a > language" > https://stackoverflow.com/questions/1579162/are-design-patterns-really-language-weaknesses That question is based on two fanciful rewrites of history, treating subroutines and OO as earlier times' design patterns. That's bollocks. Stack Overflow is more like an anti-authority than an authority: my impression is that at least in the [c++] tag about half of the answers, and of alleged facts proffered in questions, are subtly or grotesquely wrong. > you can prove that pure lambda calculus or SK combinators have the same > computational power as C++, but you wouldn't actually want to write code > like that. There will always be implementations of design patterns, in languages and libraries and ordinary code. That's what design patterns for: for language designers and individual programmers to implement them, adapted to concrete situations. Andrei's Modern C++ Design book was touted as a book about how to implement some common design patterns generically, except that both Andrei and his reviewers were very careful about stating that it was not, because patterns are language independent and without the arbitrary constraints of any particular implementation. Cheers!, - Alf |
Christian Gollwitzer <auriocus@gmx.de>: Jan 13 09:50AM +0100 Am 13.01.18 um 09:29 schrieb Alf P. Steinbach: > A main feature of the (original) command pattern is support for undo > functionality. > I fail to see how `std::function` does that. I don't know if it is possible using std::function, but in a dynamic language it is certainly possible. The whole point of the abstract base class "Command" seems to be that you can manipulate function objects as objects, store them in a list and invoke a (virtual) method on them. All of this is trivially possible in Python. You can very easily store instances or classes in a list without the need to derive them from a common abstract base class. Of course, the price to pay is that at runtime there will be a string search for the name of the method at invocation time, and the compiler does not statically check if the object does have the necessary methods at the point of insertion. Christian |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 13 09:35AM On Sat, 13 Jan 2018 00:27:39 +0000 > m.push_back(std::allocate_shared<UndoCommand>(sa)); > use(m); > } Your examples are completely contrived. Yes, you can allocate heap-like storage on the stack of the main function, but you are quibbling. So far, your "penalties that may be more significant than those present in the classic pattern implementations" seem to consist of the fact that std::function cannot take a custom allocator. Anyway, you announce with your original post that 'some classic (GoF) design patterns are no longer needed in C++' because 'lambdas wrapped by std::function, for example, can be used instead of the "command" pattern'. That's a point of view, although not a revelation of Damascene proportions, nor quite as exciting as your announcements about fixed size integer types. On std::function, you have come to the party 7 years late, but you got there in the end. Chris |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 13 10:26AM On Sat, 2018-01-13, Christian Gollwitzer wrote: > popular these days), then most of these "design patterns" seem very > baroque. std::function, lambdas, auto etc. bring modern C++ much closer > to those dynamic languages and thus make these design patterns obsolete. Aren't design patterns generally seen as a historical mistake these days? I almost never encounter them -- except the Singleton, and then it's always someone trying to get rid of a Singleton. (On the other hand, I also rarely see people do things I think are important, like invent classes of the right size and with well-defined responsibilities.) /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 13 10:34AM On Sat, 13 Jan 2018 09:50:36 +0100 > method on them. All of this is trivially possible in Python. You can > very easily store instances or classes in a list without the need to > derive them from a common abstract base class. For undo, you can have a second function object in a pair or you can have the function object take a do/undo tag argument so it knows in which "direction" to go. This is possibly not as convenient as a command object having both do and undo virtual functions. In C++17 you can have lists or other containers of unrelated types via std::any. But it is better to use C++'s static type system to your advantage and constrain them using the std::variant sum type. |
bitrex <bitrex@de.lete.earthlink.net>: Jan 13 10:26AM -0500 On 01/13/2018 05:34 AM, Chris Vine wrote: > In C++17 you can have lists or other containers of unrelated types via > std::any. But it is better to use C++'s static type system to your > advantage and constrain them using the std::variant sum type. Problem is that the performance of std::any in most non-trivial use cases sucks the lemon. |
legalize+jeeves@mail.xmission.com (Richard): Jan 12 06:03PM [Please do not mail me a copy of your followup] I like boost in general and there are some great libraries in there, but there are also some downsides. It is very intimidating and difficult for beginners to get going with libraries that require compilation. The build system is archaic, homebrew, and poorly documented. The size of the distribution is unwieldy. There needs to be a way to get targeted subsets of boost so that you don't need to download a huge thing and figure out how to build/use just what you need. On the plus side, these issues are not unknown to the boost community and they are (slowly) making progress towards resolving them. They switched to modular git on github from subversion a while back and they recently announced that they are officially adopting CMake for the build, although the distribution hasn't been offficially converted yet. Some of the slow progress is due to the fact that each library within boost has its own maintainer and so global changes move at a varied rate. I just switched my C++ Koans repo to use Catch2 as the unit test library and it was a piece of cake to switch. Catch2 is much easier for beginners to use than Boost.Test. Catch2 also feels lighter than Boost.Test even though it appears to have the same, if not more, features. The same can be said for Catch2 compared to Google Test, which is the other dominant unit testing framework out there. It feels like Catch2 is gaining more adherents over time. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
woodbrian77@gmail.com: Jan 13 07:02AM -0800 On Thursday, January 11, 2018 at 10:48:25 PM UTC-6, Real Troll wrote: > Just wondered if anybody is using Boost Libraries here? I use a pinch of Boost in the C++ Middleware Writer (CMW). > It is free and open source. The CMW is free: https://github.com/Ebenezer-group/onwards https://www.linkedin.com/pulse/serialization-benchmarks-brian-wood/ Brian Ebenezer Enterprises - Enjoying programming again. http://webEbenezer.net |
David Brown <david.brown@hesbynett.no>: Jan 13 12:48PM +0100 On 12/01/18 17:44, Stefan Ram wrote: > ::std::cin.ignore > ( ::std::numeric_limits< ::std::streamsize >::max(), '\n' ); }} > int main(){ while( askSample() ); } I cannot grasp the mentality that would make someone think this is a clear way to write code - and certainly not why you think it might help a relative beginner who asks for an advice. He asked for advice - not a re-write in an incomprehensible style that is unique to you. If you really want to help people, write your code in a style that is commonly used by programmers, books, websites, etc. And if you want to give the OP advice, don't re-do his code in a weird style - explain why you think the calls to clear() and ignore() are important. Personally, I think the original code was fine for the task. |
Intelli2 <intelli2@mama.com>: Jan 13 02:07AM -0500 Hello, You have to understand me Sir Flibble , i am genetically less emotional and also i am genetically and culturally the kind of a wise man.. we are different Sir Flibble, so now i will teach you more about morality.. Morality without patience of science is not what we call morality.. If you are genetically more emotional as Donald trump, and you are having bad feelings, this can hurt rationality and morality with a high probability, this is why patience of science is needed, so you have to be patience to attain a correct conception of morality, morality is not something easy, you have to enlarge more your view about morality, morality must be more science that knows about morality, and we must enhance morality by knowing how to set a high standard of morality, this has to be done by being more technical or/and more science, so here again you are understanding me more Sir Flibble, because your conception of morality is not correct and is inferior. Thank you, Amine Moulay Ramdane. |
Intelli2 <intelli2@mama.com>: Jan 13 01:40AM -0500 Hello, Here is again Sir Flibble I am not tuned genetically as you, i am genetically less emotional, so if you call me bad names, or if i look at the mess of our world, i am less emotional , so i will not have too much bad feelings that will hurt my morality and my rationality, you are not genetically as me Sir Flibble, you are too emotional or too sensible, so you are having too much bad feelings about the mess of our world and you are becoming more violent and you are using really bad words and cursing others, i think you are geneticlly the same as Donald Trump, he is also genetically too emotional and too sensible. Thank you, Amine Moulay Ramdne. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 13 01:43AM On 13/01/2018 06:40, Intelli2 wrote: > he is also genetically too emotional and too sensible. > Thank you, > Amine Moulay Ramdne. You fucktarded fuckwit. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Intelli2 <intelli2@mama.com>: Jan 13 01:42AM -0500 Hello, Here is again Sir Flibble I am not tuned genetically as you, i am genetically less emotional, so if you call me bad names, or if i look at the mess of our world, i am less emotional , so i will not have too much bad feelings that will hurt my morality and my rationality, you are not genetically as me Sir Flibble, you are too emotional or too sensible, so you are having too much bad feelings about the mess of our world and you are becoming more violent and you are using really bad words and cursing others, i think you are genetically the same as Donald Trump, he is also genetically too emotional and too sensible. Thank you, Amine Moulay Ramdne. |
Intelli2 <intelli2@mama.com>: Jan 13 12:40AM -0500 Hello, I have taken a look on internet at some PhD papers about the scalable FIFO priority queue from Nir Shavit, i don't think it is efficient, because it uses a same technic as the elimination array, so the consumers and the producers must meet to be scalable, and that's not as efficient as my scalable FIFO queues, also about the scalable FIFO queue with an elimination array from Nir Shavit, i think it has the same problem and it uses an elimination array as a backoff after the CAS and that's not so scalable. This is why my new scalable FIFO queues are really powerful and really useful. I have just deleted my scalable FIFO queues zip files here: https://sites.google.com/site/aminer68/scalable-fifo-queues-for-c and here: https://sites.google.com/site/aminer68/scalable-fifo-queues-for-delphi-and-freepascal because they were not optimized and they contained a bug, my new versions that works correctly are coming soon. And about my new algorithm.. I took a look on internet at the thread-safe FIFO queue using two condition variables , one for the empty condition and one for the full condition, and i have noticed that there algorithm is not working, so i have come up with a new algorithm of a thread-safe FIFO queue that is starvation-free and that works, and that uses two condition variables, one for the empty condition and one for the full condition, after that i have enhanced it to be a new scalable aglorithm that is really powerful, it is now scalable on multicore and NUMA systems. I have just finished to implement it and it is really powerful. So stay tuned ! Thank you, Amine Moulay Ramdne. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 13 12:47AM On 13/01/2018 05:40, Intelli2 wrote: > So stay tuned ! > Thank you, > Amine Moulay Ramdne. Will you please stop making multiple posts with the exact same fucking words; it is extremely fucking annoying. -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Intelli2 <intelli2@mama.com>: Jan 13 01:04AM -0500 On 1/12/2018 7:47 PM, Mr Flibble wrote: >> Amine Moulay Ramdne. > Will you please stop making multiple posts with the exact same fucking > words; it is extremely fucking annoying. What are you talking about? I have come with a new algorithm and its implementation of a scalable reference counting. Also i have come with my new scalable algorithms of a scalable FIFO queues and there implementations, they are fully scalable on NUMA and multicore systems and they are suitable for safe critical systems. Also i have come with a superb scalable algorithm of a scalable Threadpool and its implementation and also another one that is an almost scalable algorithm of a Threadpool because work-stealing, it supports three priorities , high , normal and low. This is my new inventions. Where have you done that Flibble ? you are talking stupidly here. Thank you, Amine Moulay Ramdane. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 13 01:41AM On 13/01/2018 06:04, Intelli2 wrote: > On 1/12/2018 7:47 PM, Mr Flibble wrote: >> On 13/01/2018 05:40, Intelli2 wrote: [snip] > supports three priorities , high , normal and low. > This is my new inventions. > Where have you done that Flibble ? you are talking stupidly here. Do you not understand plain English? I said you are making MULTIPLE POSTS TO NEWSGROUP WITH EXACT SAME WORDS. ONE POST IS ENOUGH. BTW, you are not the first to create a LIFO stack-based allocator (so you can't claim to have "invented it") and you won't be the last: I am thinking of making one myself. There is no download link for your amazing C++ thread pool class so I have no way of telling how bad it is. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Intelli2 <intelli2@mama.com>: Jan 13 01:26AM -0500 Hello, Read again, Sir Flibble, i correct more my typos.. I Think i am understanding more your living condition Sir Flibble.. I think you are a kind that is too emotional, i mean that you are too sensible , this is why you have too much bad feelings, this is genetical in you, you are like Donald Trump that is talking like that about Africa and Haiti , he is calling Africa Shitholes countries and he wants to not accept immigrants from Africa, i think that Donald Trump has the same problem as Sir Flibble, because Sir Flibble is too emotional and too sensible as Donald Trump, i mean that he is having too much bad feelings when he sees the mess of our world, so he is becoming more violent, so i think that he has to control more himself , Donald Trump also has to control more himself because it's genetical in them. Thank you, Amine Moulay Ramdane. |
Intelli2 <intelli2@mama.com>: Jan 13 01:22AM -0500 Hello, I Think i am understanding more your living condition Sir Flibble.. I think you are a kind that is too emotional, i mean that you are too sensible , this is why you have too much bad feelings, this is genetical in you, you are like Donald Trump that is talking like that about Africa and Haiti , he is calling Africa Shitholes countries and he want to not accept immigrants from Africa, i think that Donald Trump has the same problem as Sir Flibble, because Sir Flible is too emotional and too sensible as Donald Trump, i mean that he is having too much bad feelings when he sees the mess of our world, so he is becoming more violent, so i think that he has to control more himself , Donald Trump also has to control more himself because it's genetical in them. Thank you, Amine Moulay Ramdane. |
Intelli2 <intelli2@mama.com>: Jan 12 11:56PM -0500 Hello, To be more precise.. About my new algorithm.. I took a look on internet at the thread-safe FIFO queue using two condition variables , one for the empty condition and one for the full condition, and i have noticed that there algorithm is not working, so i have come up with a new algorithm of a FIFO queue that is starvation-free and that works, and that uses two condition variables, one for the empty condition and one for the full condition, after that i have enhanced it to be a new scalable aglorithm that is really powerful, it is now scalable on multicore and NUMA systems. I have just finished to implement it and it is really powerful. So stay tuned ! Thank you, Amine Moulay Ramdne. |
Intelli2 <intelli2@mama.com>: Jan 12 11:44PM -0500 Hello, About my new algorithm.. I took a look on internet at the FIFO queue using two condition variables , one for the empty condition and one for the full condition, and i have noticed that there algorithm is not working, so i have come up with a new algorithm of a FIFO queue that is starvation-free and that works, and that uses two condition variables, one for the empty condition and one for the full condition, after that i have enhanced it to be a new scalable aglorithm that is really powerful, it is now scalable on multicore and NUMA systems. I have just finished to implement it and it is really powerful. So stay tuned ! Thank you, Amine Moulay Ramdne. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment