Ask Slashdot: What Are the Strangest Features of Various Programming Languages?
itwbennett writes: Every programming language has its own unique quirks, such as weird syntax, unusual functionality or non-standard implementations -- things that can cause developers new to the language, or even seasoned pros, to scratch their heads in wonder (or throw their hands up in despair). Phil Johnson has rounded up some of the strangest — from the + operator in JavaScript to the trigraphs in C and C++ and indentation level in Python. What programming language oddities cause you the most grief?"
-eq as the equality operator in Powershell is pretty odd.
Posting a slideshow on Slashdot? Lame. What, was Buzzfeed not available?
It's outdated database security models that cause me the most grief. I don't want jsmith logging in from gatech.edu to be considered a DIFFERENT HUMAN BEING that jsmith logging in from whitehouse.gov. I want to say, there's ONE PERSON, John Smith, username jsmith, who is allowed to login from BOTH domains with the SAME PASSWORD and GRANTS. Nope. Can't do it. Newer versions MIGHT allow you to swap in your own authentication module instead, but NOT the authorization piece, so I'm still screwed!
"Love heals scars love left." -- Henry Rollins
I envision an add filled slideshow with almost no content, and what content is there to be boring and well known so I’ll skip the article.
To answer the question, most of perl seems to be built around bizarre unintuitive constructs that you just have to kinda know about, so pointing out any of that would seem unfair.
In C, the first time I saw the size of elements of a struct specified (i.e. int something : 3) it threw me (and that’s a hard problem to google). It was being used to essentially overlay a struct onto a chunk of memory being received via an interface and extract values, which was actually kinda a cool use of the feature (though a comment woulda been nice unknown dev!).
Some of the type erasure mechanics of Java can be a bit confusing the first time you hit up against them.
The way javascript does dates, and timezones
I dunno, most languages have their weird bits, but I can’t think of anything that is egregiously terrible.
As far as tools, I'd say pacman (Arch's package manager) and git (yes, I'm an SVN fanboy) have the highest concentration of "the hell were they smoking" flags and usage instructions. Pacman seemed to pick it's arguments randomly, and git seems to go straight off the deep end if you want to do anything non-trivial.
Goddamn AT&T assembler syntax with its reversed operands. Quick, you want to compare two registers, and jump if %rdi %rax. Which order do you place the operands to the comparison, and what's the predicate to use on the jump? Drives me nuts.
"Skill shows through where genius wears thin." -Wittgenstein || Religion: uniting aviation and architecture.
Indentation syntax is pretty odd
twitter.com/ismetozozturk
Lua's standard is, for things like arrays, to start counting from 1. The unlearning of old habits made this a hard adjustment.
Requiring a graphics card and special character set to program in the language:
Because of the unusual character set, many programmers use special keyboards with APL keytops for authoring APL code. Although there are various ways to write APL code using only ASCII characters, in practice, it is almost never done.
http://en.wikipedia.org/wiki/APL_%28programming_language%29
Since this operator exists in C/C++, Java and Perl at least, it's hardly obscure
I understand in some learning languages (Apple ][e flavor of Basic comes to mind) it can useful for beginners. But why have it languages like C#, VB,NET and even JavaScript? It would make everyone's life easier and most code run faster if you pushed your objects to strongly type variables.
You say things that offend me and I can deal with it. Can you?
I used to think that Perl's feature of "There's More Than One Way To Do It" was great until I had to start modifying and maintaining the code of other developers, (several over the years). 20+ years I've been with Perl and I gotta say that through the years this has probably caused me more frustration than anything. Python, comparatively speaking, is a dominatrix and I'm starting to enjoy "There's Only One Way To Do It".
Java Events, need a whole new class to handle them...
My alphanumerics on my keyboard failed leaving only symbols. That's why I started using Brainfuck in the mid 90's.
Malbolge uses a trinary virtual machine.
I'm pretty sure there are thumbscrews involved, too.
I think the trend on the web towards using slideshows when prose would work better is really quirky. Since each slide acts like a page hit, slideshows are a good way to drive up the ad revenue that is based upon page hits....
The alter command in COBOL.
Lo, these many years ago, when I'd just read it in a manual, and discussed it with my boss (who would have given Dilbert's a run for his money, but...) and asked him if he'd defenestrate anyone using it before or after firing them, and he told me before.....
mark
Namely, the >> symbol. Because templates use angle brackets for template parameters, if you had a nested template such as T<int, T1<double> >, you HAD to put the space between the two closing angle brackets. Otherwise the lexer would interpret the two angle brackets as the shift operator.
General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
What Are the Strangest Features of Various Programming Languages?
Fanboism.
It's still tool in the end, and a hammer of all things is what every programming language appears to be destined nowadays.
Pretty much the entire language of Prolog.
I do think it's an interesting language, and I can see why some people would like it, perhaps even a lot. But I never could get past the basics back when I first encountered it, and I haven't returned to it since then. The whole thing with relations, anonymous variables, and backtracking could lead to some pretty surprising results to a beginner.
I'd say that the column position requirements in FORTRAN 77 take the cake.
That pesky ";" statement terminator... I guess you had to uses something, but it causes me the most trouble..
C, C++, Pascal, Perl, Java, C#, bash/sh, ksh, JavaScript..... The list goes on..
"File to fit, pound to insert, paint to match" - Aircraft Maintenance 101
It makes your GO TO's GO TO somewhere other than where they say they GO TO.
Perl handles everything strangely. Their classes are so strange, and there is not a language out there that has a worse way of passing variables to methods. And by far the best unique feature, in any programming language, is its handling of regular expressions. After using Perl Regular Expressions, searching and conditionals feel like such a chore in any other language.
Troll is not a replacement for I disagree.
The iota enumerator in Golang is elegant and unique. Writing idiomatic Golang code is so implicit in the language itself that I've been able to easily read almost any Go code I find.
http://golang.org/doc/effectiv...
"I either want less corruption, or more chance
to participate in it." -- Ashleigh Brilliant
PHP: in constant and ubiquitous employ despite existing for 20 years without a formal specification. Just as strange is a feature of programming teams where they became capable of willfully disregarding this fact for two decades.
Good people go to bed earlier.
The implementation of S3 classes in R. I mean, seriously, how lazy could they have been? (and S4 classes are only marginally better.)
How is that a language quirk for JavaScript? The + operator has been used for string concatenation in a number of programming languages (C++, Java, Python...) long before JavaScript. It is still implemented as such in newer programming languages like C#.
Goodbye Slashdot. You've changed.
In VHDL and Verilog you use loops to write code :)
I don't want to do a sig now
I started with Ruby about 1 year ago. And until now, work with strings and the symbols is not natural yet to me. I mean, most of the languages I handled until now have only strings.
The worst I have ever seen was the alter statement back in the days of COBOL. Alter X to Proceed to Y. It causes a run time modification of the code such that after encountering such a statement, any references to X, actually link to Y instead. You would spend three weeks in a a 2 inch thick mass of spaghetti trying to understand how it worked, and then hit a chain of statements like:
Alter X to proceed to Y.
Alter W to Proceed to X.
Alter Z to proceed to F.
Alter J to Proceed to I.
And now you get to start over because all you knew just changed.
PHP's list of oddities is never-ending. From "catchable fatal error" to "unexpected T_PAAMAYIM_NEKUDOTAYIM".
There are some nice collections at http://eev.ee/blog/2012/04/09/... http://phpmanualmasterpieces.t... and http://www.phpwtf.org/
Does it have to be grief? One of the strangest features of XBasic is ragged arrays. It's sort of somewhere between a linked list and an array, as long as the types match you can access it as an array (as in, arrayname[x,y,z] ).
Full disclosure: since all the other official developers seem to have run off, I'm technically the lead developer at this point.
For Else in Python very strange
specifically with regards to accidentally freezing types. You've got to declare stuff with similar signatures to get your instances all nice and defined. But if you put something on the wrong line or do things in a different order... YOU'VE BROKEN IT!
In the future, I would want to not be isolated from my friends in the Space Station.
Many of us have read the PHP is a fractal of bad design article and a commonly cited rebuttal. I tried to reconcile the two and ended up with about a half dozen legit complaints.
Not crazy about scoping, or should I say, lack of scoping of local variables in ActionScript. If I bracket a chunk of code, and define local variables, they should stop being defined when I exit the scope.
If I define a for statement in C, C++ or C#, I can go: for( int i=0; i10; i++) { something...; } and follow it up by another statement that looks the same.
In ActionScript, the second for loop gets a complaint that I am re-defining a variable.
Over the years of developing C/C++ applications, I had gotten into the pattern of using scoping, particularly in switch statements, to define local variables specific to that block of code.
Heh, all of Intercal is strange.... but COMEFROM is just.... elegant.
It's been implemented for Python, of all things.....
See: https://en.wikipedia.org/wiki/...
Assigning a number or a list in Python and many other languages (Julia) is a different operation. Such as
>>> a = 2
>>> b = a
>>> a = 1
>>> b
2
>>> a = [2]
>>> b = a
>>> a[0] = 1
>>> b
[1]
Octave (Matlab) is more consistent on this point, every assignement is a memory copy.
False and True are variables and you can assign one to the other. False = True print False Not that anyone sane would do this in real code, but the thought is still scary.
Never ever seem to compile and by some miracle of God's hand, that btw aborting your unbord child will put you straight to hell, it abends.
A rule based language. 1000's of productions can be waiting to fire by querying a database (lhs waits, fires, triggers rhs updates). In my mind, its a bit like a seeing a VHDL language meet a database wrt the parallelism that comes out from it.
Programs written in it don't look at all like programs you normally would write in the life of a typical coder.
- Variables can start with a numeric, since whitespace is the token separator. This has some distinct uses in a globally scoped language, when combined with PERFORM THRU. ...
- "Concatenated OR". It lets you write code like IF 8 = A OR B OR C OR D OR E THEN
- 88 Level variables
"I don't know, therefore Aliens" Wafflebox1
Anyone coding in Regular Expressions knows that the whole language is extremely compact and is only built upon the understanding of strange features.
If any code is "Write Only" that must be the top contender.
If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
https://en.wikipedia.org/wiki/Most_vexing_parse
C++11 fixed it, but boy was it annoying before that.
Removed from modern versions of COBOL, the traditional "MOVE CORRESPONDING" was unique. Given two records with differing layouts, MOVE CORRESPONDING would shuffled the values based on the names (putting in default values where needed, or tossing aside unneeded ones).
use whitespace. Be warned, several problems have been reported when posting source code to the internet.
I'm not saying PowerShell isn't extremely cool -- it is, and I'm working on wrapping my brain around it. But I do have a lot of experience in multiplatform environments, and PowerShell's syntax is stitched together from so many sources that it gets very confusing.
- You have extensive pipeline use a la UNIX/Linux, but those pipes don't necessarily contain text, they contain references to objects. .NET-style objects/properties, these names tend to be very long and add to the number of characters.
- You have very long command syntax a la OpenVMS DCL. A line of PowerShell can perform lots of operations, but that line can be hundreds of characters long. Also, since it references
- You have branching/looping/basic structure syntax from everywhere. A little looks like Perl, some like bash, some like Java/C#.
Granted, VBScript and the various ways to interface with stuff like WMI and the XML parser were awful. I'm converting a lot of my old scripts now, and see hundreds of lines of wasted code doing stuff like opening a file, parsing fields, checking a WMI variable, executing some COM-exposed method, etc. etc. etc. It just takes a very long time to get used to the syntax, and the fact that Windows is basically doing everything for you and you're just gluing it all together.
The best feature of C and C++ is that they run like a bat out of hell.
So what is the difference you might ask? With C++ you sacrifice executable size for a lot of nifftiness.
And please don't give me that "real soon now language X will be as fast when better JITs come around". I have heard that since Java was introduced in 1995. All other languages (except FORTRAN) trade speed for even more nifftiness.
Odd integers are true; even integers are false.
Arrays can be indexed with () or []. This leads to namespace problems with functions which are also called with (). For example:
x=a(1,2)
error: undefined variable a.
If you want to call function a, you have to forward declare it for this reason.
There's a different syntax for procedures (which don't have a return value) and functions (which do).
It is required to assign the result of a function to something. You have to write
dummy = foo(1,2,3)
as writing
foo(1,2,3)
will give an error.
Most of the time, a single element array is treated the same as a scalar. But not always, and not being very careful will lead to weird errors.
There are no zero length arrays.
An array can be length 1; a multidimensional array can be length [1,2,2], but a multidimensional array cannot be length [2,1,1]. If the last dimension has length 1, it simply vanishes to a smaller dimension, unless already 1 dimensional. Example:
a = make_array(1,2,2)
; a has dimensions [1,2,2]
a = make_array(2,1,1)
; a has dimensions [2]
This means special code must be written to handle any array operations that might end with last dimension 1.
Array slices are weird.
b = a[3,*,2]
means to take a slice of a along the second dimension. I'd expect the answer to be 1 dimensional, since there's only 1 scan in the slice. But the result has dimensions [1,3]
On the other hand, a[3,2,*] has dimensions [1,1,3], and a[*,3,2] has dimensions [3]. It makes sense in a convoluted way, but it sucks.
Gotchas more than quirks:
- the day you realize you put a side effect in an assert() call.
- the day you realize GCC, maybe it was V2, not sure this is still an issue, exploits extra bits of precision in the Intel FPU, *only if* optimizations are enabled, which causes certain iterative floating point algorithms (eg SVD) to fail to converge.
In both cases everything works great in debug builds but goes to hell in release builds and it's incredibly painful to get to root cause.
So long, and thanks for all the Phish
More like, "doesn't behave like I think it should." Nothing to see here. Move along.
The only thing worse than a Democrat is a Republican.
https://www.destroyallsoftware...
^ This.
Chuck = Norris/0
Yeah with Javascript being such a huge language these days a lot of youngsters don't know how entirely bizarre and hackish it's type system seemed back in the day.
"Huh? NO type?? You just slap things on it?? But, but, what about classes??"
Cwm, fjord-bank glyphs vext quiz
catches every newb screwing around with hashes!
In the future, I would want to not be isolated from my friends in the Space Station.
Foo has object property Foo2, which has object property Foo3.
Dim aFoo as Foo
Dim bFoo as Foo
Dim b = Foo2
Set bFoo = aFoo
b = bFoo.Foo2
Why is that object not referenced?
Oh, no copy deep.
Drove me crazy writing copy methods.
"Who are you?" "No one of consequence." "I must know." "Get used to disappointment."
Ok, someone has to mention lisp.
Item from 15 or so years ago: a guy posted online that he'd broken into the Pentagon's computers, and found the code for SDI, and it was written in lisp. He didn't want to break US security, but he did post the last five lines of the code.... (stupid slashdot edit filter - 5 lines of ) was not junk... at least, not in lisp....)
mark
http://stackoverflow.com/quest...
That's a list of very strange language features. Unsurprisingly, Javascript makes many, many appearances.
-- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
Lack of unsigned numeric types, especially when dealing with binary (octet) data streams. Drives me up the fracking wall.
the growth in cynicism and rebellion has not been without cause
if (a = b) assigns the contents of b to a and executes the code following if b 0. Who the hell thought that would be a good idea?
If b is an expression that returns a reference to a newly allocated resource, such as fopen or malloc, this if statement represents trying to allocate a resource and then skipping the following compound statement if the allocation failed. It's what they had before exceptions, and it's what they still have on microcontrollers too small to have the overhead of a full-featured exception handler.
strings terminated by a binary zero rather than their physical size. Who the hell thought that would be a good idea?
Probably the same way that most popular operating systems store text files as a list of lines separated by newline characters, encoded as 0x0A on UNIX or Windows but 0x0D on Apple II or classic Mac OS. VMS is an exception in that its "non-stream" text files have each line prefixed by its length.
One of the many lovely things about PHP, though this time it's not the only culprit.
$ php -r 'var_dump("foo" == TRUE); var_dump("foo" == 0); var_dump(TRUE == 0);'
bool(true)
bool(true)
bool(false)
$ php -r 'var_dump(NULL == 0); var_dump(NULL < -1);'
bool(true)
bool(true)
Strange, and not in a good way. Makes the mathematical part of my brain explode.
Multithreading in python sucks due to the GIL (global interpreter lock)
C++ Templates are *way* more complex than they need to be.... especially when I'm mostly trying to do compile-time reflection for things like serialization. Nope, need a PhD to do anything crazy. (I always thought just a compile-time variable that describes the fields of a class plus a find/replace mechanism would work for 90% of what people want. But no you need type-traits and a PhD.
In Python I have been burned by the fact that default arguments for a method parameter are only evaluated once, even if the expression contains variables that have changed. Kinda like the function set_value_for_name(value, name=player.name). As you change player objects the default value for name will *always* be whatever the first player object was. Where as I originally thought that expression after the equal sign was evaluated *each* time I invoked the method. That's quirky and non-obvious. Not even a warning.
I dislike python's hard to follow pass-by-reference or pass-by-value semantics. Passing a list to a method is a reference, but if it's a class member list passed without calling a method, then it's silently copied and side-effects performed on the list are lost despite it seeming obvious that it would call by reference. That's a weird issue depending on how you run into it.
C++ has a bunch of quirks but it really gets interesting when you start passing C++ classes across a DDL/SharedLibrary barrier. There's chicken-egg problems, issues with who owns/destroys what, whether both sides know how much memory to allocate, whether both sides try to free/delete the same object, deadlocks from sharing mutexes across the the boundry then hitting blocking IO..... all sorts of strangeness. Then you can forget to bind with the right symbol visibility and really trash things later at runtime if there's a conflict. Also anonymous namespaces must be used to prevent globals with the same name from leaking over the boundry..... it's a lot of thinking that requires a lot of computer science concepts to be applied all at once.
By now, the only strange thing about the ternary operator condition ? value_if_true : value_if_false is how PHP has the operator's associativity backwards from everything else. Everything else interprets a?b:c?d:e as a?b:(c?d:e), where a chain of ternary operators means use the value associated with the first true condition. It's equivalent to SQL's case when a then b when c then d else e end. PHP, on the other hand, interprets a?b:c?d:e as (a?b:c)?d:e, which means using one condition to select which other condition shall apply. In my opinion, PHP's interpretation is less useful.
Do some research on COBOL's old ALTER verb that allowed self-modifying code. That wins as the strangest feature ever.
In PHP, 1 === 1.0 and 1 === '1' are both false, and 1 == 1.0 and 1 == '1' are both true. What operator should the programmer use if he wants 1 to equal 1.0 but not '1', where integer numbers are equal to float numbers but strings aren't equal to either?
I occasionally do some work in Fortran (and even rarer with matlab) and arrays that begin with an index of 1. It's so subtle and simple that I have to take a step back and try to reroute my thought process. WHY U NOT START AT 0?!?
The whole language of Prolog. Only took a semester of it in college 20 years ago but what a strange recursive language.
No Brains, No Headaches
Specially when they use it just because they can. Which is always.
Hopefully those fugly trends will be replaced with some other shit in a few years...
I'm surprised nobody has mentioned significant whitespace yet. We can forgive Make since it was invented when puchcards were popular, so we were used to Fortran's 6 columns reserved for line numbers. Still, requiring a tab character instead of spaces is a little onerous, but you should be slow and deliberate when editing Makefiles.
But Python? Come on, this is the 21st century. I'd much rather use semicolons and braces to indicate code structure. How many of us use an editor that matches pairs of braces, either by highlighting the partner when the cursor is at a brace, or by giving us a commnand to jump to the partner? With Python your choices are either Right,Right,Right,Right,Down,Down,Down,Down, or printing it out in fixed-width font and using a pencil and ruler.
I'm sure a lot of you are thinking it's not that bad, but why am I bending over backwards to serve the language? The language should be serving me!
Or, rather, the lack of strong, static, parametric typing with inference.
You can call objects with "this" as one of the parameters you pass. :)
Then the class can then save it to a global to the class variable.
Then that class has the ability to call functions in your main class
I discovered this because Eclipse for AS3(Flashbuilder) has a bug if you go over 25,000ish lines that it slows down your typing.
I started making separate classes which were just a place to put methods.
Since a lot of people are coding with AIR for Android/iOS, I'm sure someone will love using this.
God spoke to me
Because why not base syntax on an invisible character?
Blahblahblah show whitespace. Whatever. I was showing your Mom whitespace before she met your father, whippersnapper.
I am very small, utmostly microscopic.
I wrote a branching animation system entierly based on the comefrom concept. It's how animators think so that's what I did.
don't believe me?
(call-with-current-continuation foo)
RTFM and weep
def mkCounter():
c = 0
def counter():
c = c + 1
return c
return counter
count = mkCounter()
print str(count())
print str(count())
print str(count())
You'd expect "1", "2" and "3", right? Wrong!
$ python test.py
Traceback (most recent call last):
File "test.py", line 9, in
print str(count())
File "test.py", line 4, in counter
c = c + 1
UnboundLocalError: local variable 'c' referenced before assignment
When Python parses the definition of "counter", it sees the assignment "c = ..." and assumes that we must be defining a local variable "c", so it creates a slot in "counter" to contain "c". This local slot shadows the "c" inherited from "mkCounter", so when we get to evaluating "c + 1" we get this "referenced before assignment" error.
Note that it's perfectly fine to *use* inherited variables, just not to *assign* them:
def mkPrinter(s):
def printer():
print s
return printer
p = mkPrinter("hello world")
p()
This prints "hello world" as we'd expect.
All that means is that the argument of a GOTO that has been ALTERed is a function pointer. I don't see how that's any stranger than the Lisp family's feature of assigning a function to a variable and then tail-calling the function through the variable.
pretending synchronous code is magically asynchronous when you add a 10-story callback pyramid.
Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
Please stop comparing C & C++ to Javascript & Python. They (can) do different things and were designed from scratch to this purpose.
This was a stunner for me when I first encountered it. When you mix double and int types in Matlab, it demotes the double to an int! Same with float and int.
Of course, you must create the int explicitly as such (double is the default) but I mean, WTF Matlab??
If it weren't for deadlines, nothing would be late.
In Powerbuilder (a C++ based rapid development IDE) variables are always are initialized at "compile" time and not at run time. Meaning if you try to initialize a variable to a value that can change at run time, it doesn't actually work, yet there is no pre-processor warning for doing this.
For example:
Function1(int arg)
{ int foo = arg
}
Function2(int arg)
{ int foo
foo = arg
}
Say you call these functions passing a value of "3", the output of Function1 is "0" (default value of integers in Powerbuilder), the output of Function2 is "3". This has caused quite the number of headaches for fresh programmers coming in with C++/C#/Java experience.
You can use this "feature" to do some creative trolling of your fellow programmers though. For example, Powerbuilder has a native global function to run any Windows command line command. You can initialize a variable to a function return, and because variables are initialized at compile time, if you call a Powerbuilder native global function, it actually executes that function upon compiling the object! So you can write a function like the following and any programmer that tries to recompile this object (which happens automatically in PB any time you make a change to an object and save it) will find themselves being logged off. You can obviously use this to do MUCH more nefarious things, but this is generally what we've deemed professionally acceptable as a prank.
TrollingFunction() //got you!
{ int foo = Run("shutdown -l")
}
It's just javascript! Plus the worst parts of python and ruby....
Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
I'm pretty sure null-terminated strings come from the days of punch cards/punch tape where an unpunched area is read as null (binary zero). Wherever the data-entry clerk stopped typing was the end of the string and the string could be appended to latter (impossible with a non-zero end-of-string symbol or a string length in the header which can't be rewritten on card/tape).
Support Right To Repair Legislation.
It's obvious. The intention was to do evil. -- my opinion, shared by millions
I prefer Intercourse's COMEIN feature.
Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
The C pre-processor. The whole thing. The CPP is without a doubt the biggest WTF in language design. Hey, this C language is neat and all, but how about if we make it so that before you compile it you have to run it through a whole separate language processor with different syntax designed to do string substitution? And let's use that language to implement comments. And hey, how about using it to import common files? But since it's really just a string substitution, the import really just dumps a verbatim copy of the common file into the one being processed. If you have two identical include lines you get two copies of the common file inserted. Wouldn't that be *great*!?
Okay, I understand the historical context and why it made sense at the time. I really do. But from a modern perspective it's definitely not in any way the sane way to do it.
And for an honorable mention, how about the use of leading whitespace in Makefiles? Not only is leading whitespace significant, starting a line with spaces has a different meaning than starting a line with tabs!
Chelloveck
I give up on debugging. From now on, SIGSEGV is a feature.
As opposed to scheme which has =, eq?, eqv?, and equal?
csh is one big wtf. Those of you on Linux/UNIX boxes with csh active, start csh and then type:
else
Keep typing stuff in.
breaksw does the same thing. Who wrote that parser?
gives a shit?
I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.
You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.
You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.
You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.
And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.
Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.
That’s what’s wrong with PHP.
Yup. That sums it up for me.
...All of it. Just...All of it.
A subset of a data.frame is a data.frame, unless you haven't set drop = FALSE, and "select" only one column.
By default "the result is coerced to the lowest possible dimension. The default is to drop if only one column is left, but not to drop if only one row is left."
When a result is reduced to 1 dimension its type changes, and R will throw an error if you use a data.frame method on the result.
I advise anyone using R seriously to read The R Inferno to learn to avoid the many non-obvious features of R
Wow I had never seen that rebuttal. I've stopped reading because it's mostly really bad--specifically, when I got to the "PHP error handling is fine" bit. I program all day long in PHP because that's what the shop I work for uses. It is simply not as productive as other languages. The writer of "PHP is a fractal of bad design" gives mostly-accurate, concrete reasons why developing in PHP is more time consuming than in another, sane language (I realize that his point is that its design is bad, which I think is true, but pragmatically speaking, most of us care about time spent than how "perfect" something is). Good luck proving otherwise.. argh, this "rebuttal" is just so bad, drawing on obvious straw mans, etc. Okay, /rant. I'm done. Thank you for linking it, though. :)
I love the various different parsers MSSQL uses, and how very wrong things can go. Run this in SQL management studio and it will work fine... run it from the command line and it will give the below error. It will find \r\nGO\r\n and treat it as a block terminator... even if it appears in comments. This is the only command that it will find and execute within comments.
/*
declare @var as int
set @var = 10
print @var
this is totally in the comments
GO
*/
print @var
------------
output -
------------
10
Msg 137, Level 15, State 2, Line 1 Must declare the scalar variable "@var".
An absolute cluster-fuck of inconsistent syntax and bolt-on extensions.
It's pretty strange, in the best possible way.
And?? They will get unrolled/flattened in more environments than just VHDL. Still much nicer and clear than flattening everything manually.
"I don't see it as a feature - so much as exposing the core of what C is about. Its all about pointers and getting to the memory directly with as little indirection as possible. Kind of beautiful, really." Michael Neale
You could replace "Michael Neale" with NSA or credit card black hats, and make the quote even better.
My approach is generally to always use "===" and explicitly cast things. It makes your errors more explicit.
What you suggest is helpful for equality but not inequality, as I'm not aware of any <<< or >>> operator that means "less than and of the same type as" or "greater than and of the same type as" in the same sense that === means "equal to and of the same type as". The following impossible triangle of comparisons returns true in PHP:
First, Metapost is implemented as a macro language, so it is similar to C shell languages in the way it is evaluated. The symbols x, y, and z are predefined macros. For a location x the construct 3x is three times x. There are built in lengths, so 2cm and 1in are lengths. You can extend the language by defining you own macros for prefix or uinary and binary operations, which is the way that many of the operators are implemented.
The if and loop syntax
There are four levels of precedence. This is why multiplication by a constant can be expressed by putting a number in front of a value.
These are just some of the syntax features. The data types include splines, transforms, colors and numeric pairs for points. Built in operations can find points where two curves intersect and sub-curve sections between intersections.
It's fun in a strange fashion, and you can make some interesting geometrical pictures.
Why is Snark Required?
The CDC3300 FORTRAN compiler would compile indexed array accesses as pointer accesses, keeping the pointers in one of the three index registers on that system. If you changed the index variable, the compiler would of course update the corresponding pointers.
Unless you managed to update the index variable in a way invisible to the compiler, for example, by doing I/O into it. In which case, the pointers would not reflect your update. So for an index I, you had to type "I=I" after doing such I/O.
And just why would you do such a daft thing as I/O into your index variable? Well, this wasn't FORTRAN 2015. Or even FORTRAN 77. Or even FORTRAN IV. This was FORTRAN II with a few extensions. It did not support anything like a C struct. But you could emulate a C struct using a named common block. And there was a CDC extension to do bulk I/O into common blocks called BUFFER IN and BUFFER OUT. So if your pseudo-struct contained an index variable (call it "I") used to indicate an element in an array in that pseudo-struct, every time that you did BUFFER IN into that pseudo-struct, you had to do "I=I".
Needless to say, lots of confusing bugs from this one. ;-)
get neat one-liners for a thing most C programmers don't bother to do
Not bothering to check whether an allocation succeeded is a problem.
at the expense of adding a hard to notice source of bugs to every if statement.
Several compilers display a diagnostic for if (variable=value) which is silenced with if ((variable=value)). GCC for example offers -Wparentheses to warn "when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people often get confused about."
Turing has a drawfillmapleleaf procedure that....draws a filled maple leaf.
Reference here: http://www.beens.org/turing/Turing_Graphics_Summary.htm
Standard COBOL (COBOL-85) has both DO WHILE and DO UNTIL loops. But UNTIL loops are actually WHILE loops: they test the exit condition before executing the loop.
If you really want an UNTIL loop you have to code extra syntax:
perform until condition with test after
statements...
end-perform
I never understood why an object has a method that returns an interator instead of having the methods themselves. There might be a good reason, but it has always escaped me.
The user is coming FROM those gatech.edu and whitehouse.gov domains to a third one.
An OpenID relying party is allowed to map multiple identifiers to a single user account. So if gatech.edu and whitehouse.gov are OpenID providers, you can register using your identifier from gatech.edu, add your identifier from whitehouse.gov to the same account, and then get the same userid (which maps to the same grants) no matter which identifier you used. Stack Exchange supports this feature if I remember correctly, and I know the authentication system I wrote for PhilsHobbyShop.com supports it.
Perhaps one of the reasons PHP endured despite being such a slapdash language was that some commercial shared web hosting providers tended to charge less per year for packages that allow only PHP than for packages that also allow Perl, Python, or especially Java.
FreePascal: logical and bitwise 'and' and 'or' are the same operator, it just chooses one for you based on the operands. Example: "if (i < 5 and j < 10)". The compiler tries to do a bitwise and of 5 and J, then compare it to i, and then it gets confused about how that result (a boolean) can be less than 10
When I first saw PowerShell my first thought was it borrowed syntax from COBOL.
putting the 'B' in LGBTQ+
I've always wished that you could do the following
if ( a == b == c)
or even
if ( a c )
etc
But most languages you need
if ( a == b && b == c)
or
if ( a b && b c )
Programmers are rarely sane.
putting the 'B' in LGBTQ+
No more needs to be said.
in brainf**k, you use . to accept one byte of input and store its value in the byte at the data pointer.
Robot programming language named SLIM.
Let's see:
In principle, you have wiggle room of 500 integers (suffix: %), 500 floats (suffix: !), 50 strings (suffix: &), 8 robot positions, 8 shifts (kind of offset value applied to a robot position to to dynamically modify it), 8 buffers (may contain 64kb of data, instead of 200 bytes the strings have; handy with socket communications) and 8 shift registers (used mainly with serial port) but global and another set private to "unit". Keep in mind though that top part of the integer, real and string areas are also occupied by built in PLC.
There are no variable names! Instead one refers to variables just by number L10 %by reference: L%[10], so at leas there are arrays. Variable names are bolted on the system via preprocessor, but unlike CPP, it does not do tokenization by white space, so definitions "count,L10%" and "countervar,L11%" interfere with each other. At least it causes a compilation error instead of bug, with "L10%ervar" ending into the program.
Oh, and there are variables with names, defined with DIM command, but they can't be used with most built in commands, so they can only really be used to hold intermediate values in calculation. Local variables wont work with all commands either, specially I encountered that _optional_ TCP/IP socket functions refused to work with local variables, but confusingly one could use a "DIM variable" as a parameter to those. I don't know what is supposed to be a bug here and what not...
There are two types of subroutines. Classic basic like "GUSUB", and something called "user procedures", that may contain above mentioned useless "DIM variables" and supposedly allow writing safe code (much use for that with maximum 999 lines). Maximum stack depth is 8 and maximum parameters per user procedure 3. Also, the user procedure defining line can't be longer than 100 characters, elsewhere the maximum line length is 255. I want to hit every member of the committee that decided on this broken feature and hug the poor programmer who had to implement it.
Line numbers are present too! Labels can be used, but not everywhere, as some robot movement command take line number as as a step to go to if an error occurs. The programmer does not supply the line numbers though, instead they are implicitly the same as the line count of the program, meaning blank lines count! This is possible because most of movement oriented programs are entirely done on teach pendant, which keeps the line numbers updated. This, and the fact that commands with "expressions" can't be edited with teach pendant at least promote modularity, as one must separate the program's movement parts and business logic parts to different files.
This,my friends in a product released in 2011! The worst thing is, all the robot controllers, PLC's, smart cameras etc. program quite similarly. The best system so far I have met was in cognex cameras, where the environment was modeled after _spread sheets_. Sounds horrible but was 10x nicer than the abominations that take inspiration from commodore basic.
: CELEBRATE FORTH LOVE IF HONK THEN ; and remember that : ? . ! ; is a straightforward part of the language definition.
"When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
The == operator in Java is similar to the == in C++ for strings where is compares the memory address and not the string value. I understand why this is in C++ because strings are pointers to chars but in Java the datatype is String. I was pulling my hair out in college on this one! Fyi, you need to use the equals function on Java to compare values.
'1' + 1; returns '11'. It's weird when you have javascript's type coercion.
IBM's RPG language also starts with 1.
I think it has more to do with younger web devs being taught to not have more than one screen of content on a page. I taught an HTML class at a local community college and got in trouble for teaching students to put more than a single screen of content on a page. The head of the department believed users weren't able to scroll so you shouldn't even have a vertical scrollbar. Too many teachers misunderstand the guideline to put important things "above the fold" is a law rather than a good design rule of thumb.
In all the various awks the string concatenation operator is implicit. Brian Kernighan is quoted as saying "It seemed like a good idea at the time".
Thus, awk literally has an invisible operator. Most coders make this a little more obvious with an explicit space, ASCII code 32 (decimal), but it's still invisible. Hijinks ensue.
Other that this, awk is admittedly a great language for text processing. And the GNU awk is an exceptionally good version - it permits fixed fields and socket I/O and has numeric conversion operators.
MATLAB was one of the first languages to allow lists of comma-separated numbers between square brackets e.g. [1,2,3,10] to be interpreted as indexed numeric arrays or vectors. A lot of languages do that now, but MATLAB was perhaps the first to do this in 1984. A little-known quirk is that the commas are optional! [1 2 3 10] etc. This was probably introduced as a 'convenience' feature (though typing a space isn't that much faster than typing a comma). But there is a glitch ("feature") in the syntax that interprets space-separated negative numbers differently than you'd expect. So [ 1 2 -3] is interpreted as [1,2-3] (value = [1,-1]) because the precedence of arithmetic operators is higher than list operations.
MATLAB hasn't fixed this 'feature' yet, because it would undoubtedly break a jillion apps around the world. So you must be careful to type [1 2 (-3)] if you are allergic to commas.
BTW it's been fixed by default in OCTAVE, MATLABS free-software clone, but you turn 'quirks' on, if you want to preserve the quirky behavior.
The parens in the condition should be optional instead. I think new languages (go, Perl6) do it like that.
Platform lock-in is the strangest feature of some languages that purposely defeat all the progress we made since Assembler. This is why I will never C#
Pass the wrong type of object to a javascript library. The library happily accepts your crud, passing it through 14 levels of function calls and then says something useful like "a is not a function".
http://michaelsmith.id.au
Perl is my preferred language for the majority of tasks that I do. I really like Perl overall. TIMTOWTDI annoys me, though. There is a right way to do it. Once is a great while, there are two correct ways, and still one best way.
TIMTOWTDI seems more appropriate for PHP, "do it however, as long as it looks like it kinda works for now. It's not like we're actual programmers who know what we're doing".
These two are very, very handy for careful programmers, who don't just assume that everthing always works, and that noone is trying to hack, or enter "weird" input like a name with a single quote, such as o'Malley.
Examples:
open(INPUT, $file) or die "Couldn't open input: $!");
compare other languages, where being careful requires that every other line start with "if (!":
if(!open(INPUT, $file) ) {
die "Couldn't open input: $!";
}
Similarly:
die ("That's an awfully long name") if (($name > 1024));
vs:
if ($name > 1024) {
die("That's an awfully long name");
}
If you're regularly checking your assumptions, I think the syntax is very handy.
I'm not sure how I ended up typing those extra parens. Odd.
No one's mentioned Objective-C's bracket notation for calling methods. Instead of obj->method(argument) or obj.method(argument), it's [obj method:argument]. Perfectly logical I'm sure, but the few times I've tried to write Objective-C code I've always had a hard time wrapping my brain around it.
Tcl is strange in a number of ways. One is that you don't assign variables by saying "x=5", you write "set x 5" instead. Nor can you do any calculations outside of the expr command (in most cases), so instead of writing "x=5*y+3", you would write "set x [expr 5*$y+3]"
I'm still fond of Tcl/Tk, in spite of that. :) What other language can give you a text editor in one line? "pack [text .t]"
... with C, C++, Objective-C, java and perl you can say "function name/method name (args)" Ruby chokes if there's whitespace between the function/method name and the arg list.
%DTC ;1/16/92 11:36 AM
;;19.0;VA FileMan;;Jul 14, 1992
;
;
;
%DTC ; SF/XAK - DATE/TIME OPERATIONS
D I 'X1!'X2 S X="" Q
S X=X1 D H S X1=%H,X=X2,X2=%Y+1 D H S X=X1-%H,%Y=%Y+1&X2
K %H,X1,X2 Q
C S X=X1 Q:'X D H S %H=%H+X2 D YMD S:$P(X1,".",2) X=X_"."_$P(X1,".",2)
K X1,X2 Q
S S %=%#60/100+(%#3600\60)/100+(%\3600)/100 Q
H I X S %Y=$E(X,1,3),%M=$E(X,4,5),%D=$E(X,6,7)
S %T=$E(X_0,9,10)*60+$E(X_"000",11,12)*60+$E(X_"00000",13,14)
TOH S
%H=%M>2&'(%Y#4)+$P("^31^59^90^120^151^181^212^243^273^304^334","^",%M)+%D
S %='%M!'%D,%Y=%Y-141,%H=%H+(%Y*365)+(%Y\4)-(%Y>59)+%,%Y=$S(%:-
1,1:%H+4#7)
K %M,%D,% Q
DOW D H S Y=%Y K %H,%Y Q
DW D H S Y=%Y,X=$P("SUN^MON^TUES^WEDNES^THURS^FRI^SATUR","^",Y+1)_"DAY"
S:Y
[...]
The C# GoTo statement is pretty uncommon to see in use:
http://msdn.microsoft.com/en-u...
I'm not familiar with JavaScript but I thought the plus sign is an arithmetic operator? var1 + var2 = output
for i = i++;
I forgot my C++. lol
Gotta love a BXLE or perhaps a CDS for those special occasions? Or what about a MVO? (You know who you are)
Probably the same way that most popular operating systems store text files as a list of lines separated by newline characters, encoded as 0x0A on UNIX or Windows but 0x0D on Apple II or classic Mac OS. VMS is an exception in that its "non-stream" text files have each line prefixed by its length.
The conventions for line endings are based on history. DEC's operating systems and operating systems descended from them use CRLF because that is what you had to send to an ASR-33 teletype at the end of an output line. UNIX and its descendents use NL, which has the same code as LF, because they were targeted at later printers.
By the way, the VMS record length field was 16 bits, avoiding the limitation of 255 characters in systems which used only 8 bits for the string length.
Wow - like how many times are we going to go rounds with the quirks of a language. I mean this is just getting sadder and sadder. We ARE in a tech bubble, and its goin to pop pop pop - and all these idiots who spend time writing about quirks and comparing languages who can justify their time on this stuff should be the first ones out the dooooor!!
-Possibility to access the "parent" scope
-Distinction between "workspace scope" and "global variables"
-Really weird stateful behaviour when using/declaring global variables
-Impossibility to redirect the output of commands under special circumstances
-Lazy copy in combination with slices (yeah, awfully practical, but run a profiler to see what happens)
-At least two different ways of associating data with "handle objects"
-"handle objects" (feels like the early 80s)
-weird scopes for function declarations
-absence of a decent "map" operator
-half-assed "function handles"
In assorted languages. Java and vbscript being particularly problematic, if you're a library programmer. "Oh, I'd like to write this generic container of things but I can't make it generic because some programmer might try to store an int in it :-/" Java's introduced some features to address that, and it's quite easy to solve in vbscript by never programming in vbscript.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
Perl is pretty bizar in a hilarious sort of way - almost every aspect of it. PHP, being Perls former template engine, sheds most of that just to add in it's own featureset from wonderland. Both get the job done, PHP a little more so.
Coulnd't say that for Lingo though. As far as regular usage PLs go, Lingo is about as shitty as it gets. 'Please' is an actual Lingo keyword - with no effect other than to make the sourcecode more polite. No joke. And seriously - that is not even its crappiest feature. If you want to kill braincells and a mixture of crystal meth and crack isn't fast enough, check out Lingo. Gladly it's basically gone extinct since the demise of Director, its platform.
Transcript is simular to lingo, without the outlandish crappyness - but still pretty bizar.
TypoScript is Typo3s configuration language. Think of a total programmer n00b learning just enough PHP4 to do turing complete stuff then inmediately trying to implement Basic for his CMS with it and failing one 3rd it but keeping the ruins as main means of configuration. Typoscript is what happens when a guy who can't programm takes psychoactive drugs and then takes a shot at it.... Luckyly there are some good oreillys on it, which makes it bearable. Sort of.
Perhaps the language with the most bizar appearance is Lisp./eLisp. How anyone could come up with that syntax is totally beyond me. It must be realy powerfull if it is still around. ... Then again, emacs is a very strange programmin itself, so no supprise here.
We suffer more in our imagination than in reality. - Seneca
I'm surprised no one has posted wat yet. Even though it's a video, I really found it interesting and funny.
The "if (a = b)" syntax is among the first things newcomers to C are warned about. It's not a big problem.
Null terminated strings are a bigger problem. What do you do if you want to embed nulls in a string? Not use the entire string.h library for starters, have to write your own routines. It really is better to store the length in a simple integer, as long as it's not stupidly small like in Turbo Pascal where they set aside one measly byte, thus making the maximum length a paltry 255 characters. There are simply too many use cases where length information is needed. Having the length makes a strlen function trivial and run in constant time, instead of a time dependent upon the data. We now have the String class in the Standard Template Library which addresses these problems.
Bigger yet are the limitations of the function call syntax. This is not just C, but most programming languages that originated in those times. Most functions have a fixed number of parameters. If it's known how many parameters there are, it is not necessary to enclose the list. Basic math is done without that, eg. c = a +b instead of something gross like equal(&c,add(a,b)), Why can't functions be done the same way? Because they decided to allow variable numbers of parameters, with the printf function being the most prominent example of such a function. This was done in a very awkward manner. Consequently, most programmers avoid it. But we still have to include the parentheses even for functions with a fixed number of parameters. C enshrined parentheses as basically a sigil to distinguish function names from variable names. What does C gain from this? The ability to curry? No. Recursive functions? No, don't need variable length parameter lists for that, it does recursion anyway. The good in C's function syntax is that the programmer doesn't have to use a key word like "call" to call a function, and C has no unnecessary distinction between a function and a "procedure" as in Pascal. Can sort of do some functional style programming by passing pointers to functions. But they didn't get functions good enough. Operator overloading is an ugly hack that tries to address these inherent deficiencies. It doesn't succeed, can't go far enough. Same with polymorphism and name mangling. And C++'s addition of prefacing a parameter with an ampersand is nice, but merely a syntactic shortcut. The latest C/C++ standards also nibble at this problem with things like the introduction of "auto". But it still has the fundamental problem of excessive parentheses, like in LISP. C is all about brevity and economy, in both syntax and compiled code, but in this, they didn't do as well as they could have.
Then there's parallel programming. C wasn't designed for it, and can't do it clearly and cleanly. To be fair, there isn't a general purpose language that really nails parallel programming. Does it make sense to have to clear an array by using a loop, as in "for (i=0; i<MAX; i++) a[i] =0;"? Not if you're trying to use the massive parallelism of current commodity graphics cards. To this day, parallel programming remains a sort of black art, to be attempted only by the most skilled and intrepid programmers. Similar to the reputation that assembler still has in some programming circles, or that network programming used to have (sockets, ooh, scary!) Just include the magic library and call the magic functions, let them handle the complexities.
And that brings me to the next point, the libraries. The language designers didn't put enough consideration into libraries, or they would have realized how huge the entire set of libraries could get and made some provisions for that. Instead, years later namespaces were added. The next problem with the libraries is related to the problems with function calls. The library interface is too language specific. Those header files are a mess that makes it much harder for another language to use the related functions. A common solution is to resort to "wrappers", like m
Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
Py3 changed this.
SyntaxError: can't assign to keyword
The Python GIL
...none of its examples are in anyway WTF. I can't believe nobody has mentioned Fortran's arithmetic IF yet...
Tubal-Cain smokes the white owl.
I had a quick scan through and didn't see many real perl comments :/
Im JAPH so generally notice when moving to other languages, here's some of the main ones that come to mind:
- Default variables - perl adds a range of variables based on context, such as @_ for the array of args passed to a subroutine, or the default input $_ which doesn't even need to be specified in many cases. (i.e. "shift" is equivalent to "shift $_" )
- the basic variable type prefixes: $scalar, @array, %hashmap - though you often work against $references when using arrays or hashes anyway.
- context based return values - a sub can check if it was called expecting a scalar or array as a return value, and act accordingly.
There are plenty more but those where what immediately came to mind, and are already more unique than most of the examples mentioned so far. (IMO)
Yet another person who doesn't know enough about the language to know when he's reading bullshit.
Dartmouth BASIC? Try HP in 1974
HP 2000 C/F Time share BASIC
Dual HP2100 with swap drum, user file and system disk, 9 track backup tape.
256K Word, 32 users. 110 Baud dialup
10KB program space (tokenized), Per user (seemed like a lot more)
Vars A0-Z9, strings, 2d mats
Computing environment supplied to Portland Or. public schools High school student body in 1970-1975?
In MUMPS, now mostly used in Intersystems Caché, white space is significant in a strange way. There are places where one space is required and other places where two spaces are required.
"Almost every wise saying has an opposite one, no less wise, to balance it." - George Santayana
> if (a = b) assigns the contents of b to a and executes the code following if b 0. Who the hell thought that would be a good idea?
There are indeed times it is useful but I 100% agree, using the _same_ syntax as assignment was full retard.
The same syntax as what exactly? = is just assignment, nothing else.
They should of used:
You should of used "have". And your proposal is utter crap.
CLI paste? paste.pr0.tips!
Verilog is unbelievably bad. For instance, a wire in Verilog can take on four possible values: 0 (false), 1 (true), X (unknown), or Z (undriven). This works great for a large subset of the language (including, e.g., gates, assignments, most expression operators).
And then you get to the procedural language, where anything that's unknown gets arbitrarily treated as false! For instance, if a is X, then this will print False!:
if (a == 0) $display("True!") else $display("False!")
This almost sort of makes sense from a simulator-design perspective. If it was just for debugging code, it would be reasonably okay. But then... the procedural language is basically mandatory for any sequential logic like a latch or a flip-flop, so even the most basic way of writing an edge-triggered register:
always @(posedge clk) q = d;
Will completely incoherently treat a transition from 0 to X as a posedge. Anyway, the procedural language of Verilog is, I would contend, even worse than PHP.
Not quite, it should return the size of a memory pointer on the target machine, since that is what a "string" is in C.
FU makefile and the bastard who thought it was a good idea.
Now I've seen Everything
http://deslide.clusterfake.net... d.com/slideshow/163234/head-scratchers-10-confounding-programming-language-features-434442 OR http://desli.de/11J3
Ant(Dude) @ Quality Foraged Links (AQFL.net) & The Ant Farm (antfarm.ma.cx / antfarm.home.dhs.org).
I was actually in the room when the decision was made, so this is the god's honest truth: It's because DOS had already camped out on , |, and &. We could have used ==, but it just wouldn't have done to have -gt, -lt, -or, and -and, but stick with ==.
Jim, if you're reading this, I want you to look upon your legacy and weep.
Sorry, that's < >, |, etc. Can't post the alligator signs on web forums...
Whole of javascript. absolute fucking mess.
Here is it on one page without ads: http://deslide.clusterfake.net/?o=html_table&u=http://www.itworld.com/slideshow/163234/head-scratchers-10-confounding-programming-language-features-434442
A language feature which I find confusing, quirky, and elegant all at the same time.
Maybe it does not want to promote the number of significant figures that integer represents?
I found out about this the hard way. Apparently optimisations that optionally change the behaviour of code in unpredictable, unexpected ways are just fine.
Net result: my rather elegant code had to be replaced with a long, ugly hack. Not happy.
A string literal in C is of type char[N] (where N is the minimum value required to store the whole string, including the null terminator). String literals degrade to pointers quite easily, so yours is a common error. So... // 4 or 8 on most 32- or 64-bit architectures, respectively
const char direct[] = "string";
const char *const indirect = "string";
sizeof(direct) == 7;
sizeof(indirect) == sizeof(char*);
http://www.w3schools.com/jsref...
"Note: Older browsers will result parseInt("010") as 8, because older versions of ECMAScript, (older than ECMAScript 5, uses the octal radix (8) as default when the string begins with "0". As of ECMAScript 5, the default is the decimal radix (10)."
A 21st century issue: the irony of technologies of abundance in the hands of those still thinking in terms of scarcity.
If you think all strings can be defined as const char arrays, then your experience with C programming must be very limited. The vast majority of strings in use in real world programs are neither const, nor defined as arrays.
Lucky for both of us, that's not what I think. I specifically said "string literal", which is a const array and not a pointer. This is relevant for the sizeof discussion because the operator is evaluating the size of the array (therefore the entire string) and not just evaluating the size of a pointer.
XLR (http://xlr.sf.net) has essentially a single operator, -> which reads as "transforms into". The rest is defined in the library.
(OK, to be honest, that's the theory. In practice, the current language implementations take many shortcuts).
-- Did you try Tao3D? http://tao3d.sourceforge.net
I find Malbolge's encryption an interesting and nice feature. After an instruction is executed, the value of the current instruction (without anything added to it) will be replaced with itself mod 94. Then, the result is encrypted with one of two methods.
http://en.wikipedia.org/wiki/M...
Elxsi Fortran had it long ago.
Richard Maine in FORTRAN IV program illustrating assigned GO TO on web site
The Elxsi compiler in the mid 80's actually implemented the comefrom
statement (and several variants) as a continuation of this spoof. It
wasn't documented, but I found out about it when Ralph Merkle (one of
the developers) suggested that I might be amused by looking at a certain
area in the compiler executable file. When I did so, I found a list of
strings containing mostly familliar Fortran keywords. Amidst those, I
spotted comefrom. A quick check verified that the statement actually
compiled and worked as "expected".
I later heard that the statement was pulled from the compiler after a
customer submitted a bug report (I think it was a
performance/optimization issue) related to the comefrom statement
implementation. The joke wasn't worth actually investing scarce support
resources on.
much of left-wing thought is a kind of playing with fire by people who don't even know that fire is hot - George Orwell
In Forth all of the syntax is in Reverse Polish notation, like an HP calculator. Including the arguments for procedure calls.
The following is perfectly legal Haskell, and does exactly what it looks like:
Most human behaviour can be explained in terms of identity.
http://www.thedailywtf.com/ - Curious perversions in information technology
http://stromberg.dnsalias.org/...
My dad and I wrote a BASIC interpreter for the IBM PC in the '80s called BBasic, based on the Acorn BBC Micro dialect. BBC BASIC had an "EVAL" function, where it took a string and interpreted it as an expression. I persuaded dad that we should expand this functionality to an EXEC statement, that would take a string and interpret it as BASIC commands. If you put a line number at the start of the string, it would insert the code in the string into the program that was running - so you could have self-modifying BASIC code. There was one restriction, that if any of the points in the call stack were prior to the inserted statement, then it would fall over in a very untidy heap.
It actually turned out to be pretty useful, the one used that I can remember was to store persistent data within the program itself, and you could save a program as an executable that included a runtime interpreter.