Continuing the #python#CoPilot example, one can make it work by upping their prompting game.
In addition to the description of the algorithm, give the desired input and output.
It immediately suggests to define a class for intervals, followed by a line sweep over the sorted intervals.
It can generate some (sorted) test cases after prompting. *Surprisingly it had some issues with printing the results (for whatever reason, it could not generate the unpack-print loop, so I just did it
@mjgardner@matsuzine@Perl@EricCarroll There is another dimension that should also be considered here, that of productivity. Getting the prompting right for #largelanguagemodel to generate a chunk of code that works & testing said code, may end up taking more time than actually doing the deed by hand. It makes more sense (IMHO as a hobbyist) to have good metadata about functionality for software libraries so that they can be located & reused, with #metaprogramming generates the boilerplate.
There's a lot of hate for C++ going around the Fediverse these days, understandably. There is many reasons to hate C++, ranging from its C roots to the breadth and width of modern revisions of the language and their standard library, so extensive that it has become progressively harder for any individual developer to have a complete understanding of the whole thing.
One of the most controversial features in C++ is the hidden “language within the language” of templates —an emergent byproduct of the generics implementation from the first revisions of the language, that has been kept despite the obnoxious syntax for anything nontrivial and the complexity of the error messages when anything goes wrong. The resulting #metaprogramming capabilities of C++ turn out to be surprisingly powerful while at the same time falling flat in the most unexpected of ways.
But the biggest issue with C++ #templates#metaprogramming isn't just the syntax (that has been improving in the last years) and the errors. To paraphrase an XML joke, «C++ metaprogramming is like violence, if it doesn't solve your problems, you're not using enough of it.»
The moment you start using metaprogramming, it creeps into every corner of the code base, often requiring several layers of indirection and extensive auxiliary classes to achieve a relatively simple “user” interface.
That being said, I'm actually among the perverts that are fascinated by #templateMetaProgramming (even though I'm well aware of its limitations pertaining readability and maintainability). Which is why I took @tess venting as an opportunity to challenge myself into writing a workable approach to generic properties for C++ objects with a common interface:
Added a “Non-initializer builders” section based on comments from @maxim. (Thanks!)
Added a “Module identity” section based on the same discussion.
This morning, after the penny dropped the rest of the way, I rewrote the initial “The instance-mixin duality” section extensively to hopefully be clearer.
@ssfckdt Bondage-and-discipline #programming languages at which you can throw waves of interchangeable newbies make life easier for business managers.
#Perl’s reputation was spoiled by waves of newbies producing bad code anyway during the early “Web 1.0” years, followed by a splintering of its core community as #Perl6 (now #RakuLang)’s long development Osborned it to outsiders.
It didn’t have much to do with its #metaprogramming capabilities.
🤔 The Expressivity Limitations of Object-Oriented Programming
➥ two-wrongs.com
"tl;dr: Writing software is encoding knowledge. Knowledge takes the shape of propositions. Compressing rich propositions into is-a and has-a relationships does not lend itself to clarity."