|
The Gripper posted:The worst is with concurrency frameworks and the like, where the most promising looking example is almost always some complex mathematical computation which probably looks clean and makes a lot of sense to someone that knows that particular math, but to anyone else it's difficult to separate "here's the code I need to use to implement this for my own use" from the "holy god m=p*x ^ 7; _,x=sub1(-y^(x)^add1(m));" part. I find this general thing to happen with the documentation on an un-trivial number of libraries. That is, illustrating usage of the library with examples that seem too domain-specific or outside of the knowledge base of a significant portion of their users. I can understand why this happens, and that sometimes it's the best illustration, but I don't like it!
|
![]() |
|
![]()
|
# ? Jun 10, 2024 16:32 |
|
pokeyman posted:Well optional parameters aren't the same as parameter defaults, though in C# I understand you can't do one without doing the other. Visual Studio will allow a project set to v3.5 to compile optional / default parameters, but MSBuild will not. Trigger lots of "Works on my machine?" when the CI build fails.
|
![]() |
|
Funking Giblet posted:Visual Studio will allow a project set to v3.5 to compile optional / default parameters, but MSBuild will not. Trigger lots of "Works on my machine?" when the CI build fails.
|
![]() |
|
pokeyman posted:Well optional parameters aren't the same as parameter defaults, though in C# I understand you can't do one without doing the other. Well, you can use the OptionalAttribute to flag something as optional without providing a default value. In that case the "default value" is implicitly specified as either Type.Missing, or default(T).
|
![]() |
|
Does this count as a coding horror? http://www.youtube.com/watch?v=xF0-LGoXtaw
|
![]() |
|
You'd think that fans of a language with legendarily glacial compile times wouldn't include a phrase like "we'll keep compiling till the end" in their song.
|
![]() |
|
Dicky B posted:Does this count as a coding horror? that is how you do something like that right
|
![]() |
|
Internet Janitor posted:You'd think that fans of a language with legendarily glacial compile times wouldn't include a phrase like "we'll keep compiling till the end" in their song. I make heavy use of an Intel API which internally heavily uses templates. 6.5 hours compile time for a single object file. Average memory use, 13GB
|
![]() |
|
Beef posted:I make heavy use of an Intel API which internally heavily uses templates. Use more pimpls.
|
![]() |
|
So I'm working on this Rails app today (that someone else made) and I come across this little treat. Be forewarned that I found this at the bottom of model. In a gem. That's required by the Rails app.code:
The fact that the guy who had my job before me could even fathom such a confusing and lovely way to code is ludicrous to me. May God have mercy on the souls of his current and future team members...
|
![]() |
|
Call the gem 'andandfuckyou'
|
![]() |
|
ToxicFrog posted:I can't help but feel that a lot of code like this would be more readable if the mathparts could be written in - and rendered properly by the editor as - LaTeX. Doxygen supports LaTeX... code with LaTeX equations and citations in comments is weird.
|
![]() |
|
hobbesmaster posted:Doxygen supports LaTeX... code with LaTeX equations and citations in comments is weird. I was actually thinking something more like: you open it in your IDE of choice and rather than a clusterfuck of calls into the math library, you see beautifully formatted LaTeX equations in the code itself, which the compiler translates into the appropriate calls into the math library.
|
![]() |
|
essentially:php:<? class Bar { public function __construct(...) { // typical constructor... } } class Foo { public function __construct(...) { // .. return new Bar(...); } } ?> ![]()
|
![]() |
|
Does that actually do what it appears to be trying to do? If it does I'm torn between being horrified and being amused at how it sort of solves one of the sort of problems with new.
|
![]() |
|
PHP apparently just ignores the constructor's return value. Which, I suppose, is more sane than the alternative. Ideally it would throw an error, but then again it's PHP. Proof
|
![]() |
|
CHRISTS FOR SALE posted:
I've never read it, but Avdi Grimm makes the case for this in Exceptional Ruby, and also on his blog. quote:Very often in Ruby code, we would like to execute some action only if an object is present: He then goes on to explain how returning self makes it very easy to silently nullify method chains. He goes on even further after that.
|
![]() |
|
Objective-C works like that. It's easily one of my favorite features of the language.
|
![]() |
|
At some level, the problem is with the of the concept of a NULL pointer, even with stricter type systems such as Java, in that it's the only value which is allowed to lie about its interface. In that case of the "slug" example, if they created a URL from a slugified NullObject, they'd crash and burn anyway, as attempting to convert the NullObject to a string would just return another NullObject object, correct?
|
![]() |
|
code:
![]()
|
![]() |
|
yaoi prophet posted:
Maybe monads legitimately rule.
|
![]() |
|
Suspicious Dish posted:In that case of the "slug" example, if they created a URL from a slugified NullObject, they'd crash and burn anyway, as attempting to convert the NullObject to a string would just return another NullObject object, correct? The twist ending of the blog post I linked is that the whole thing isn't really useful.
|
![]() |
|
yaoi prophet posted:
I'm glad someone posted this. Monads rule.
|
![]() |
|
CHRISTS FOR SALE posted:So I'm working on this Rails app today (that someone else made) and I come across this little treat. Be forewarned that I found this at the bottom of model. In a gem. That's required by the Rails app. I've actually written something pretty similar: code:
|
![]() |
|
There's a certain database driver I have to use that has two wonderful features:
Text fields treated as integers are silently converted for you - until the value is null. Then it crashes your production server, requiring a reboot.
|
![]() |
|
Atimo posted:Text fields treated as integers are silently converted for you - until the value is null. Then it crashes your production server, requiring a reboot. Let the punishment fit the crime.
|
![]() |
|
Look Around You posted:Maybe monads legitimately rule. TRex EaterofCars posted:I'm glad someone posted this. Monads rule. It's the Functor method, don't need no monads. ![]()
|
![]() |
|
From Die EmacsWiki, Die!:quote:Some of the features of the wiki are simply abhorring - like the lack of user access control; anyone can enter any user name and edit the wiki… Yep, this is not a joke… Today I learned I can backdoor Emacs users just by editing an unauthenticated Wiki!
|
![]() |
|
floWenoL posted:From Die EmacsWiki, Die!: I understand what they mean but I enjoy the idea of anyone being able to edit a wiki being "abhorrent."
|
![]() |
|
Vanadium posted:It's the Functor method, don't need no monads. I will defer to those who know better but isn't the Maybe monad what's doing all the magic there?
|
![]() |
|
TRex EaterofCars posted:I will defer to those who know better but isn't the Maybe monad what's doing all the magic there? The Maybe type is indeed what is in play there, but the fact that Maybe happens to be a Monad isn't relevant. The instance of Functor for Maybe (a much simpler categorical structure) is all that's required for that code.
|
![]() |
|
I found appmodel.m today. It took a long while to find appmodel.m; but when I did, I understood. You see, appmdel.m is where I found the entire logic for the application. In terms of that whole branching logic thing. About 57/58kb of non-xcode generated, non third-party source code weight. Thank god the app is pretty. And it technically does work. But for the live of christ can some one walk these graphic designers cum iOS devs through sepa-loving-rations of concerns.
|
![]() |
|
Jonnty posted:I understand what they mean but I enjoy the idea of anyone being able to edit a wiki being "abhorrent." The problem isn't the "anyone can edit", it's the "anyone can edit any page while claiming to be any user, with no form of access control or authentication". Even fully public wikis generally require one to create an account and associate your edits with that name by logging in.
|
![]() |
|
ShoulderDaemon posted:The Maybe type is indeed what is in play there, but the fact that Maybe happens to be a Monad isn't relevant. The instance of Functor for Maybe (a much simpler categorical structure) is all that's required for that code. Yeah. You don't really need to use the monadic properties of Maybe in this instance (and <$> is infix for fmap of a Functor typeclass). A really, really awesome introduction to functors, applicative functors, monoids and monads (including what they are and the differences between them) is chapters 11-13 of Learn You A Haskell.
|
![]() |
|
ToxicFrog posted:The problem isn't the "anyone can edit", it's the "anyone can edit any page while claiming to be any user, with no form of access control or authentication". Well, to be fair it is a Wiki for the GNU/RMS text editor. RMS posted:Ever since passwords first appeared at the MIT-AI lab I had come to the conclusion that to stand up for my belief, to follow my belief that there should be no passwords, I should always make sure to have a password that is as obvious as possible and I should tell everyone what it is. Because I don't believe that it's really desirable to have security on a computer, I shouldn't be willing to help uphold the security regime. On the systems that permit it I use the “empty password”, and on systems where that isn't allowed, or where that means you can't log in at all from other places, things like that, I use my login name as my password. It's about as obvious as you can get. And when people point out that this way people might be able to log in as me, i say “yes that's the idea, somebody might have a need to get some data from this machine. I want to make sure that they aren't screwed by security”.
|
![]() |
|
Lucky for him, he doesn't connect to the internet often. He would need to change back his background from goatse every odd hour.
|
![]() |
|
That's the stupidest thing I've ever heard a computer person say. That, or that statement somehow predates the Fall of Man and the arrival of evil in the world.
|
![]() |
|
It's from 1986, http://www.gnu.org/philosophy/stallman-kth.html. I'm not sure if his view on security has changed in any way, but it's freedom all the way down.
|
![]() |
|
It's also to be taken in the context of a hacker/research group, before the advent of decent network infrastucture.
|
![]() |
|
![]()
|
# ? Jun 10, 2024 16:32 |
|
Beef posted:It's also to be taken in the context of a hacker/research group, before the advent of decent network infrastucture.
|
![]() |