Programming thread

it has lots of those batshit insane "elegant" syntax sugar that looks like some retarded haskell shit and then you try to do a closure and you have to declare your variable "nonlocal" which makes very little sense
These are annoyances but on balance I find Perl 5 more annoying and also there are various alternatives to list comprehensions. Medium and sites using its CMS tend to generate a lot of clickbait titles and this seemed like one of them but it was actually pretty decent:
pacman -Ql perl | grep Math
maybe the arch packagers included some stuff from cpan in the standard perl for some unknown reason but it doesn't seem very 3rd party if it comes bundled in with the interpreter
I looked and Mint has a similar thing going on ... you are in fact right (search "BigInt" in files here: https://github.com/Perl/perl5) so it's strange that the code would also be on CPAN. I take back at least part of what I had to say about Perl and arbitrary-precision integers but it appears that true decimal arithmetic for example really is third-party code.
 
Can a code get demonically posessed?
Can satan be in a code itself, a code that looks innocent?
or does it have to be written in a specific way?
what the fuck are you talking about? the code is simply what controls the spirit that lives inside the computer to do the magician's bidding
the processes generated by such code can be varying levels of fucked up though
I looked and Mint has a similar thing going on ... you are in fact right (search "BigInt" in files here: https://github.com/Perl/perl5) so it's strange that the code would also be on CPAN.
maybe cpan just indexes modules that are developed in the perl tree because i don't see a huge reason why doing that would be bad
I take back at least part of what I had to say about Perl and arbitrary-precision integers but it appears that true decimal arithmetic for example really is third-party code.
i also see big rational numbers in the package and i think it can do infinite precision decimal arithmetic if you use it right
 
  • Thunk-Provoking
Reactions: Belisarius Cawl
To quote the Spartans: "if". I really just want to be able to do stuff like Decimal('0.1') + Decimal('0.2') and not worry.
Perl:
use Math::BigRat;
print Math::BigRat->new("1/10")->badd(Math::BigRat->new("2/10"));
# => 3/10 (exact number)
it claims to manipulate fractions with infinite precision which i believe is good enough
are there any weird footguns with working in rational and converting to decimal at the very end?
 
Not every rational has a finite decimal representation. That should be it.
obviously, you have to round any decimal you create from a rational number
that's often intended though, as you can't pay somebody 5/7ths of a cent
in any case i would be confident in saying that rational numbers are way better than ieee 754 single precision for financial calculations
 
that's often intended though, as you can't pay somebody 5/7ths of a cent
Typically financial institutions have some fixed minimal unit, something like 1/100th of a cent or something, then they do all calcs using integers.
 
Isn't one of the main reasons COBOL still exists is because it had/has a native decimal type
cobol was designed to make financial-type calculations easy in the time it was made, and it did have a decimal type
many businesses still rely on cobol programs because it still works and it's too expensive and risky to pay people to replace it all
nowadays you can use any retarded language for financial math, and even more languages if you follow snigger's advice of using integers that represent a fraction of a cent (this isn't specifically decimal math, just fixed point)
 
  • Like
Reactions: Belisarius Cawl
Isn't one of the main reasons COBOL still exists is because it had/has a native decimal type
I think it's mainly because control flow in COBOL is a nightmare and can't be cleanly translated into any other language (code is structured into labeled "paragraphs" that normally flow into the succeeding paragraph, but a paragraph or contiguous sequence of paragraphs can also be called as a subroutines by a PERFORM statement, which can also be a for-loop and/or a while-loop). This "feature" is aided by a complete lack of local variables (they may have done something to improve this in more recent versions of the standard, but I don't care enough to check). I'm pretty sure this is implemented by having each paragraph end with an unconditional branch instruction to the next paragraph, and the PERFORM statements patch the appropriate one to return back to the caller before branching to the PERFORMed paragraph, and then patch it back to linear sequence upon return, but don't quote me on that. PL/1 was intended to replace both Fortran and COBOL, and had a proper decimal type for that reason but didn't really take off through a mixture of the sheer size and complexity of the language and the inability to easily convert existing COBOL spaghetti.
 
I think it's mainly because control flow in COBOL is a nightmare and can't be cleanly translated into any other language (code is structured into labeled "paragraphs" that normally flow into the succeeding paragraph, but a paragraph or contiguous sequence of paragraphs can also be called as a subroutines by a PERFORM statement, which can also be a for-loop and/or a while-loop). This "feature" is aided by a complete lack of local variables (they may have done something to improve this in more recent versions of the standard, but I don't care enough to check). I'm pretty sure this is implemented by having each paragraph end with an unconditional branch instruction to the next paragraph, and the PERFORM statements patch the appropriate one to return back to the caller before branching to the PERFORMed paragraph, and then patch it back to linear sequence upon return, but don't quote me on that). PL/1 was intended to replace both Fortran and COBOL, and had a proper decimal type for that reason but didn't really take off through a mixture of the sheer size and complexity of the language and the inability to easily convert existing COBOL spaghetti.
Sounds like Ansible. I hate ansible btw. And I hate indians. I also hate indians who work on ansible project that is part of my current project.
 
I hate ansible btw. And I hate indians.
I actually like Ansible. It works well for what it's intended for. And once you understand Jinja2 and writing your own modules when needed you can do some wonderful things. However the intersection of Pajeet and Ansible is something horrifying to behold. Had one where it was simple code "look up x in the dictionary, write file with that data" x 10 or so. Instead of normal person coding using a loop, they wrote 10 different task files, one per x. And another, which wasn't Ansible's fault, we had a demo due, for the previous 2 weeks they said "Oh, yes, saar, all going well." Two days before we're like, ok, internal team demo before we present it. Yea, none of it fucking worked at all. I got the pleasure of fixing it all, in about the same time as it would have taken me to write it from scratch.
 
Instead of normal person coding using a loop, they wrote 10 different task files, one per x.
anybody who does this and can't recognize why it's wrong needs to be legally blocked from ever going near a computer again
much like how pedophiles are kept away from children
 
Back