Top tag
Next privilege 200 Rep.
See reduced ads
~4k people reached

  • 0 posts edited
  • 0 helpful flags
  • 106 votes cast
comment Why “Fork me on GitHub”?
They are social widgets, much like those that appear with the 'share' link on a SE question/answer: you get widgets for Google+, Facebook and Twitter. They're ready-to-use for the site designers, so easy to integrate. I think there is no such thing for e.g. Bitbucket, so there's nothing to notice: if any project has their own, home-brewed 'fork me' widget, they would not look like any other one, presumably.
comment Does functional programming ignore the benefits gained from the “On the Criteria To Be Used in Decomposing Systems into Modules” (data hiding)?
In a ML-like language, not having access to the constructors means that you can't pattern match over a value of that type to deconstruct it. The only things you can do with those values is to pass it to whatever function was made available. It's the same sort of data abstraction as is done in, say, C which doesn't have first-class notions of what is public or private either.
comment Why is there no 'finally' construct in C++?
@MasonWheeler The 'extra' work amounts to being refactoring work. Any bugfix in the class benefits all use sites. Compare that to reviewing the correctness of each and every try/finally constructs -- what happens if you find a bug in one? How do you know where to look in case you made a similar error, except that the other sites may be subtly different due to how those things compose and nest? RAII is not used by C++ programmers because or despite a lack of try/finally, but for its own merits (or: I've never, ever forgotten to close anything in C++).
comment What does mathematics have to do with programming?
@DeadMG It's impossible for arbitrary programs. A given program can very well be proven to terminate or not terminate, in some instances.
comment What is the purpose of arrays in C, when pointers could have done the job?
@DanielScocco What comes with an array that doesn't come with a pointer is information about the size. So a (pointer, size) pair or a (pointer, pointer) pair can indeed hold just as much information as the name of an array. Whether this means that arrays are pairs of pointers (or vice-versa) seems more like a metaphysical question, so I'm not really interested in answering that. (The answer is probably no as pairs of pointers look more like slices, and hence can do more than just refer to an array.)
comment Is hungarian notation a workaround for languages with insufficiently-expressive (i.e. Haskell-style) static typing?
Being object-oriented is neither necessary nor sufficient for a language to allow xFoo + yBar for user-defined types, nor is the OO aspect of C++ necessary for that example to work.
comment When to use C over C++, and C++ over C?
@Lundin Of course you wouldn't want to use std::string if you don't want dynamic allocation. You'd use std::basic_string<char, std::char_traits<char>, some_allocator_here>.
comment Difference between Idiom and Design Pattern?
@Merlyn That doesn't fit my uses of 'idiom'. An idiom of a language is something you expect a random, proficient user of the language to recognize; reimplementing a first-class feature will look alien and out-of-place. There's no C++ idiom for single dispatch, one just uses virtual in some places whereas hand-written pointer to members table trickery will look just silly.
comment Difference between Idiom and Design Pattern?
@Merlyn What's idiomatic about reimplementing a first-class language feature? Who does that?
comment When would dynamic scoping be useful?
x = 42; foo(); x = '42'; bar();?