- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Only in a weakly typed language can you get these stupid constructs. Also frist?
Admin
After his frist position at Leonardo's company, that guy moved on, and happens to be Bernie's coworker now. He continues to produce great gems re-inventing virtually everything...
Admin
On a certain level, if the universe works, it can only be so wrong to allow for an isoentropic filter of all light to uncertainly enter an infinitely invincible expanding geocentric event horizon generator, but to pound a theortically possible "Hammer of Thor" so loudly it traps itself into a paradoxical vortex, bring light to the very essence of an hyperly converging yet paradoxically expanding ever unobservable Big Bang Theory.
Such puny winds may never topple the towers that stand upon the 1D Idealistical Dually Invincible and Yet Inevitable 4 Towers of the mythical demigod crom ! ! !
What insolent weaklings to question if a prime mover exists, plunging me into the very darkest of dark? Hell ? ? ? NO!!!! A 30 Year Virginic Supercylce of Human Wizardy ! ! !
We do not to live in the ever expanding universe. We do not need to destroy it. Such a bicameral mind only exists in the small minds of Medical Professionals, Scientific Researchers, and the current writers and editors of whoever thought the hell out of the current "Detective Comics" plotline.
What to do in such a situation? Here. Let the mythical power of "reason" paint a picture for you! FOR FREE ! ! !
Admin
if comment is stupid but it works, don't hold it for moderation
Admin
. . . that not only speaks to man, but speaks to the clouds and heavenly interstellar universal bodies itself. You know that a dualistic spectrum of Jeeperness/Creepiness self limiting thought exists to limit the very essence of the Packet of Time itself ! ! !
No one should tell you what to do, just the same as people shouldn't even be near you !!! You are temporaral malignancy, giving a self fullfilling theory to the very grinning nightmare of life itself ! ! ! That it's nothing more than a living breathing 6D Membranic Perpetual Stroop Test on top of an infinite series of uncertain codebases of highly convergent 5D2D Supergravity ! ! !
That you are a deranged contractor, the theoretical Super Hyperly Converged Indus Asian Conspiracy that marshalled all the course of history, all the Fleets of the Atlantic and Pacific to crash not just the beach head of Troy in the Last Stand of Achilles, this bringing infinite light to the world, you somehere can here the "backwards" knocking of a completley dopplergantic 10 figure truely emperical divine head at the center of time itself ! ! !
Admin
Odds are, we've done it already with David Finch's Mindhunter Season 1.
Stay Tuned for the Death of all Reason as We know it, or:
David Finch's Mindhunter Season 2: The Wayan Williams Story 4K, brought to a burning hateful city of ontological diversity near you ! ! !
Unless, of course, you have other plans . . . like don't be a jerk and be nice! !!
Admin
I see some of you have been watching the turbo encabulator video.
Admin
I'm so glad the Ruby one is epic UB in sane languages like C and C++,(1)(2) because that way I'd never write it, and I wouldn't have to understand why it even works. And no, Remy's description only made things more confusing.
(1) By design, this part is deliberately provocative, in case you didn't realise.
(2) In the same sequence-point domain, it writes to
status
and also reads it for a purpose that isn't calculating the value written.Admin
For #3, the decision to use a string-indexed dictionary was driven by having seen certain other libraries that are unable to serialize dictionaries indexed by integer.
Admin
I once noticed a curious warning in the CPPUnit test case compilation: " "a < b < c" does not have its mathematical meaning". I investigates the test case in question, and found something similar to assertTrue (65 < numFrames < 75); The problem was, the condition was evaluated as ((65 < numFrames) < 75), and since (65 < numFrames) was either true or false, it was converted to 1 and 0 respectively, so it was certainly less than 75. The check always succeeded. When I changed the check to assertTrue (65 < numFrames && numFrames < 75); the test case failed. Debugging and correcting the test case took about a week.
Admin
The moderation rules in this site are so excellent...
Admin
The moderation rules are stupid, but they work. So don't change them.
Admin
In Javascript, all object keys are strings. Arrays are objects where the keys are numeric strings, so this isn't exactly so very far from what actually happens behind the scenes... (Javascript, of course, being TRWTF.)
Admin
"a < b < c" does not have its mathematical meaning", except that it Just Works in Perl 6 (is b between a and c?). I seem to recall another language that does that too.
Admin
R language rejects "A<B<C" . Matlab evaluates left-to-right, as one might guess. Thus both 5<6<7 and 6<5<7 evaluate to TRUE
Admin
Works also in Python.
Admin
As a proponent of strongly-typed languages, preferably with implicit typing, I'd be interested to know which of these three idiocies can be invalidated by the simple avoidance of weak typing.
Other than one case (a single case) which would very possibly invoke a compiler warning -- not the same thing at all, and since it's (hint) based upon operator precedence, it's not really related to strong typing -- I can't see the difference.
Admin
I was thinking something sort of similar. The last time I worked with JavaScript libraries (~10 years ago), some of them were known to change the base types in weird ways that broke things. I figured they reimplemented arrays because they couldn't trust the builtin array type.
Admin
It sort of works; it's an AST hack that doesn't preserve associativity. (Perl6 does it the same way, only because it's built into their grammar system it encourages users to build buggy syntaxes around it.)
Obvious in a trivial example, but it means defensive parens in complex expressions can cause silent failures.
Admin
Back many years ago, someone at my work made the comment "If it works, it is aesthetic.". In context it was about designing hardware, but it also applies to software. Yes, we all strive to have clean understandable code (don't we?!) but if you get correct results, all is forgiven.
Unfortunately, the "works" case is elusive, and no amount of programming works to get it for some people.
Admin
Yes, if you add parentheses to override the built-in precedence and/or associativity, you might get different results. That's not news, and it's not a "hack". Your "doesn't preserve associativity" comment is nonsense - the associativity of those operators is what it is (Perl 6 calls it "chain associativity"). It's not somehow one associativity if you write a < b and a different associativity if you write a < b < c.
Admin
The ruby code does not work when status is undefined - it throws the exception "undefined variable". When status is 1 it returns true, otherwise it sets status to 1 and returns false.
Admin
This has been posted before. Why reuse it again? Don't post at all if you have nothing new.
Admin
5 < 6 < 7 doesn't work in C#, because "the <-operand cannot be used on types 'bool' and 'int'", meaning that it evaluates '5<6' to true and then cannot evaluate 'true < 7'.
Admin
Erm, no actually. If status is undefined Ruby throws a NameError. The Ruby snippet returns true if status is already defined as 1, and false if it's already defined as anything else.
Admin
It's more that in my experience strongly typed languages make you think a little bit more about what you're doing. So while it wouldn't prevent these things from happening it certainly makes it a lot more awkward to achieve. I just see more of this kind of thing happening in weakly typed languages I just took a statement to the extreme forgetting you're not allowed to do that on the internet because sarcasm disintegrates on contact with the internet.
Admin
The reinvention of the array might be from someone burnt by peculiarities in Javascript, JSON and other languages. It's still wrong but probably comes from that. Because Javascript is typeless people get objects and arrays mixed up. It's not intuitive. Some languages will JSON serialize populated maps to object but empty maps to array. Javascript has a poor comprehension itself of what's an array and what's an object (since an array is an object and object is a map that already overrides []).
It's possible someone has that implementation to handle sparse arrays as well which wont be so sparse if you serialise them or even try .length (internally how sparse arrays are handled is down to the implementation). However in that case, the number of elements appears to be redundant for anything other than a performance hack (which might introduce more problems than it solved).
Such a pseudo array will work with [int] as it'll coerce the int to a string. Array will do the opposite, if ["0"] is used it will convert it to a uint if it's the toString of a uint. With an array it'll appear as invalid things such as -1 work but in reality it's falling back to the default behaviour of object.
It's common for newbies to instead of trying to figure out how JS works, to do their own thing instead.
Admin
In C or C++ the
status == status = ...
part wouldn't even compile because it parses as(status == status) = ...
, i.e. it's trying to assign to the result of a comparison. Perl5 also rejects this with a compilation error.(The
1 < x < 10
case mentioned elsewhere is also a syntax error in Perl5 because it (quite sensibly) makes the comparison operators non-associative.)Admin
if status == status = 1 || status = 2 || status = 3
How does this work? Ruby precedence rules put == higher than =. Therefore "status == status" should evaluate to True, and "True = 1" should fail, because you must have a variable on the left hand side of an assignment. But for some reason when I try "status == status = 3", for example, it return False, but then sets status to 3. Ruby seems to have some odd precedence exceptions.
Admin
I fight that fight with JSON and JavaScript constantly. It's bad enough on a side project where it's relatively low-level (no frameworks). With an MVC/Entity/ERP workflow, though, absolutely nowhere is safe from that "everything everywhere is a string because reasons" mentality.
Admin
Good old environment variables are strings too. Why bother with anything else than byte sequences? It's far easier to look whether we can interpret some byte sequence as a textual representation of a number than having types.
(Oh yes, and good ol' Hypertalk, where not only everything is stored as a string, but a string that might be a syntactically correct variable name but hasn't been used as a variable name in an assignment so far is interpreted as that string itself - medieval scholars called this "autonymiy", a thing that is unknown in modern mathematics since 2nd half of 19th century and any halfways sane programming language.)
Admin
It does this in ICON, by design, since operators (and other functions) either "fail" or return a result, and chaining them together will return "fail" as soon as any fail.
Admin
I submitted a good WTF article ages ago, but flavorless crud like this continues to get posted. Sigh.