|
hackbunny posted:what's the realloc problem? The realloc problem is that (in the standard) we can't have allocators with a reallocate function because realloc copies the data at the old location and that will most likely break types that aren't TriviallyCopyable. If realloc didn't do a copy it'd probably be part of the standard allocator interface because it would allocate a new block or simply grow the old one and the user could check to see if they needed to do the copy themselves. Its doable on several platforms but at that point you're writing a whole new stdlib. maybe well get lucky with std2: template boogaloo hackbunny posted:huh, you're right, I was overthinking it. I'm still very unfamiliar with type_traits, vararg templates etc. because back in my day we had to trait our types uphill both ways etc. that is what happens when you have a template function in a templated class where it requires you to explicitly specify the template function's parameter and you're calling it from a templated function where you dont know the inner templates of the template class. it is only occasionally necessary, but is the reason get<I> is not a member function for std::tuple because then you'd see "my_tuple.template get<I>()" everywhere. if you only use GCC you might not have run into it because they did a thing where it didn't care if the template keyword was there or not (it was also a poor choice on my part because i was trying to not let someone gain direct access to the underlying storage of the variant) edit: (and i was also getting differing behavior regarding friends and template functions under gcc and clang that is probably not an issue anymore)
|
# ? Nov 30, 2016 02:04 |
|
|
# ? Jun 9, 2024 06:22 |
|
Slurps Mad Rips posted:The realloc problem is that (in the standard) we can't have allocators with a reallocate function because realloc copies the data at the old location and that will most likely break types that aren't TriviallyCopyable. If realloc didn't do a copy it'd probably be part of the standard allocator interface because it would allocate a new block or simply grow the old one and the user could check to see if they needed to do the copy themselves. Its doable on several platforms but at that point you're writing a whole new stdlib. maybe well get lucky with std2: template boogaloo oh right, I hadn't thought about it. so when say a vector runs out of capacity, it has to allocate a whole new vector and copy itself to it? (or move if T supports it I guess)
|
# ? Nov 30, 2016 02:10 |
|
hackbunny posted:oh right, I hadn't thought about it. so when say a vector runs out of capacity, it has to allocate a whole new vector and copy itself to it? (or move if T supports it I guess) it used to be that simple it only moves if the move constructor is noexcept. hence, the std::move_if_noexcept function, which is allowed to waive the strong exception guarantee if the move constructor is not noexcept and there is no copy constructor.
|
# ? Nov 30, 2016 02:24 |
|
I am not convinced c++ is a programming language. every conversation about it seems as orthogonal to every other programming chat as a conversation about Verilog would seem
|
# ? Nov 30, 2016 06:10 |
|
com has had VARIANT for like 20 years, idk what the big deal is
|
# ? Nov 30, 2016 06:12 |
Bloody posted:I am not convinced c++ is a programming language. every conversation about it seems as orthogonal to every other programming chat as a conversation about Verilog would seem C++ is a programming language for lawyers, right down to the laws not being accessible to anyone without $100 lying around to spend on the standard.
|
|
# ? Nov 30, 2016 06:41 |
|
chmods please posted:com has had VARIANT for like 20 years, idk what the big deal is it's not typesafe. say it contains an integer and you access it as a string. c++ variant will stop you at compile time
|
# ? Nov 30, 2016 09:04 |
|
the type safety was inside you all along
|
# ? Nov 30, 2016 09:16 |
|
you know what else is inside of me?
|
# ? Nov 30, 2016 09:20 |
|
Bloody posted:I am not convinced c++ is a programming language. every conversation about it seems as orthogonal to every other programming chat as a conversation about Verilog would seem MrMoo posted:For a spiffy SPSC queue read you a Lynx Queue, using page faults around a ring buffer to avoid socket contention on the head/tail pointers. Ok, that is really cool idea.
|
# ? Nov 30, 2016 09:38 |
|
Jesus Christ, while I think type-level programming in Coq or Idris is complicated, at least there is some coherency and fundamental simplicity at play. C++ is just a nightmare. Even Haskell isn't close to that complexity.
|
# ? Nov 30, 2016 10:00 |
|
Xarn posted:But Verilog is a programming language? page table fuckery is so dangerous/unpredictable though, would not go that route even with the numbers looking good in their tests
|
# ? Nov 30, 2016 10:43 |
|
Athas posted:Jesus Christ, while I think type-level programming in Coq or Idris is complicated, at least there is some coherency and fundamental simplicity at play. C++ is just a nightmare. Even Haskell isn't close to that complexity. haskell will only ever hope to aspire to make functional programming as complicated as c++. every time i deal with the inefficacy of c# templates i die on the inside and dream of again being abused by c++ tho.
|
# ? Nov 30, 2016 14:33 |
|
c c++14 s: implementing a template polymorphic visit method
|
# ? Nov 30, 2016 18:01 |
|
VikingofRock posted:C++ is a programming language for lawyers, right down to the laws not being accessible to anyone without $100 lying around to spend on the standard. the source for the standard is on github these days, so there's no reason to actually buy the official publication
|
# ? Nov 30, 2016 18:43 |
|
Xarn posted:But Verilog is a programming language? debatable
|
# ? Nov 30, 2016 19:18 |
|
hackbunny posted:c c++14 s: implementing a template polymorphic visit method Huh. There exists a variant impl under the "eggs" namespace somewhere on Github. https://github.com/eggs-cpp/variant I replaced boost::variant uses with it in RethinkDB and stuff still worked, and it compiled 10% faster.
|
# ? Nov 30, 2016 19:27 |
|
Bloody posted:debatable
|
# ? Nov 30, 2016 19:41 |
|
JawnV6 posted:no, it's not its a programming language in the same sense that xml/xslt is. like, you can use it as a programming language, but you shouldn't
|
# ? Nov 30, 2016 20:13 |
|
sarehu posted:Huh. There exists a variant impl under the "eggs" namespace somewhere on Github. https://github.com/eggs-cpp/variant
|
# ? Nov 30, 2016 20:41 |
|
Arcsech posted:its a programming language in the same sense that xml/xslt is. like, you can use it as a programming language, but you shouldn't if we're talking about "you can use a hdl simulator as a runtime" the language is so stretched as to be meaningless. makes the scaffolding between a interpreted language vs. compiled look trivial.
|
# ? Nov 30, 2016 20:45 |
|
verilog is turing complete
|
# ? Nov 30, 2016 20:47 |
|
in fact in the strictest sense of turing completeness, its probably rather good at it
|
# ? Nov 30, 2016 20:47 |
|
but whats a pl without a runtime
|
# ? Nov 30, 2016 20:49 |
|
the build process takes around 3 months
|
# ? Nov 30, 2016 20:52 |
|
"how can it be a PL if it can't even print strings?"
|
# ? Nov 30, 2016 23:36 |
|
Gazpacho posted:"how can it be a PL if it can't even print strings?" I was going to make a programming language with no I/O capability whatsoever, and adding such would be specifically forbidden in the licence it would be fully-featured, but the compiler would optimise every program down to a no-op
|
# ? Nov 30, 2016 23:40 |
|
Gazpacho posted:"how can it be a PL if it can't even print strings?" verilog doesn't "communicate instructions to a machine", the string-printing faculties are always giant rafts of complexity that would put most vm's & interpreted environments to shame it's not a programming language and any hint of that reductive thinking actively hinders doing anything useful in it
|
# ? Nov 30, 2016 23:46 |
|
the real hindrance is believing that there's a bright-line distinction between hw and sw
|
# ? Dec 1, 2016 00:08 |
|
JawnV6 posted:but whats a pl without a runtime a miserable little pile of secrets
|
# ? Dec 1, 2016 00:11 |
|
please don't troll this thread gaz, tia
|
# ? Dec 1, 2016 00:12 |
|
Malcolm XML posted:a miserable little pile of srams
|
# ? Dec 1, 2016 00:18 |
|
JawnV6 posted:my dictionary has "hardware description" and "programming" on different pages why do you think i compared it to using loving xml, a document markup language, as a programming language
|
# ? Dec 1, 2016 00:21 |
|
HDLs are used to describe information processes. idk where you get this idea that they must describe it to another information processor to be a PL and if you don't work in business IT you might be forgiven for not realizing how relevant chip architecture concepts are in modern distributed architectures, e.g. enterprise buses and service opcodes etc
|
# ? Dec 1, 2016 00:31 |
|
Arcsech posted:why do you think i compared it to using loving xml, a document markup language, as a programming language also, i have no idea what xml/xslt are and im not one to let ignorance hold me back from stating an opinion
|
# ? Dec 1, 2016 00:33 |
|
Gazpacho posted:HDLs are used to describe information processes. idk where you get this idea that they must describe it to another information processor to be a PL Gazpacho posted:and if you don't work in business IT you might be forgiven for not realizing how relevant chip architecture concepts are in modern distributed architectures, e.g. enterprise buses and service opcodes etc Gazpacho posted:the real hindrance is believing that there's a bright-line distinction between hw and sw
|
# ? Dec 1, 2016 00:37 |
|
JawnV6 posted:im not one to let ignorance hold me back from stating an opinion
|
# ? Dec 1, 2016 00:50 |
|
with the power of Icarus Verilog, your Verilog can indeed be computer instructions!!!
|
# ? Dec 1, 2016 01:09 |
|
ok, let's step back and rationalize. implementing variant, even a lovely buggy limited version of it, takes a huge amount of code, almost all of it metaprogramming. what does variant do?
and for now I'll stop here or I'll never go to sleep if this sounds well-reasoned, well, don't worry: this is the reasoned post-mortem of a full day of throwing poo poo at the wall to see what stuck. my usual holistic approach isn't helping much: there is so, so much to learn, and the endless quirks, traps and pitfalls of template metaprogramming make it really hard to apply my (vague) functional programming knowledge, because so many times the obvious solution is in fact a syntax error hackbunny fucked around with this message at 01:50 on Dec 1, 2016 |
# ? Dec 1, 2016 01:12 |
|
|
# ? Jun 9, 2024 06:22 |
|
did anyone else start saying "oh what no no no no" to themselves while reading that
|
# ? Dec 1, 2016 01:40 |