Live data from Hacker News

C++ in Coders at Work

gigamonkeys.com

161–170 of 174 posts

Re: C++ in Coders at Work

#161

Earlier quoted context omitted.

No, I got it all right, that's what I meant. Each user subsets word for themselves in to what they need/can handle.

No, that's still not my point. Each user has a different subset of Word. Hence, the only set that contains all of the features that all users use is Word itself. If everyone uses a different subset, it's not accurate to call it bloated, too large, or complain it has unnecessary features. All features are necessary for someone.

A feature can be simultaneously "bloat" and "used by someone".

Re: C++ in Coders at Work

#162
post #52

Earlier quoted context omitted.

It was more the other way around, I think. Implementers had a lot of power to say, "No, this can't be done efficiently," and as a result, the burden was passed to programmers instead. Can you give an example of a "pet construct" (aside from major features like multiple inheritance and exception handling) that could have been left out?

I think operator overloading, which seemed like a 'great idea at the time' with some forethought should have never been part of the language in the way it works right now. The times that I ran in to examples where it was used properly and elegantly I think it could have been done just as nice with a properly named function call. I think the way it workd came from the DSL camp arguing that you should be able to make i…

[deleted]

Re: C++ in Coders at Work

#163

Earlier quoted context omitted.

Thus proving the authors point even further. It is funny how everybody really seems to have their own favorite subset of C++.

Just as Lisp programmers add new syntax and vocabulary to build custom languages, C++ programmers do the same by taking them away.

Does anyone really use all of Common Lisp?

I'd say the justification for all of the large languages (like C++ and Common Lisp) is the same. You may not need all of it, but the features you do need will at least be standardized, compared to using a small language with ad-hoc extensions to achieve the same.

[ I here include the standard library as part of the language, for languages with extensive meta-programming support like C++ and Common Lisp, it makes little sense to distinguish. ]

Re: C++ in Coders at Work

#164

Earlier quoted context omitted.

roughly 90% of the comments are from people who got a bad impression of C++ during the pre-standardization days Zawinski and Thompson are good, but they are not 90% of Zawinski, Thompson, Bloch, Eich, Ingalls, Armstrong and Steele. You're completely misrepresenting the gist of the article. The comments that really drop my jaw are the people who seem to hold up Java as a "better" C++. http://www.paulgraham.com/icad.ht…

i'm not so sure about that. a few months ago i was working on a project that involves amazon ec2 and s3. amazon gives you a bunch of command-line utilities, written in java, to perform various stuff. every one of them takes a second or two to start up, which really annoyed the heck out of me. that certainly wouldn't have happened if they were written in c++.

Startup time is, IMHO, not an essential part of a 'performance', as it is usually negligible compared to the time the actual execution (often in the order of weeks) takes. But granted, for the case of small apps performing short lived tasks, JVM startup adds a relatively large amount of overhead, which can be annoying.

Re: C++ in Coders at Work

#165
post #153
post #85

Earlier quoted context omitted.

I characterize C as a portable assembly language.

Sure, portable assembly language. With, you know, named variables, type abstraction, recursive function decomposition, infix expression grammar, heirarchical flow control constructs... just a bunch of silly tricks. :) Modern developers have gotten so used to the fact that C is "low level" that they tend to forget how low really low level coding is. There's a ton of "high level" language features in every 3GL, and tha…

One of the odd things about C, historically speaking, is actually how impoverished it was compared to macro assemblers written at around the same time. Those didn't have much of a type system either, but you could get all kinds of power with them. No modern assembler is really comparable, much to my dismay.

Re: C++ in Coders at Work

#166
post #145

Earlier quoted context omitted.

I think operator overloading, which seemed like a 'great idea at the time' with some forethought should have never been part of the language in the way it works right now. The times that I ran in to examples where it was used properly and elegantly I think it could have been done just as nice with a properly named function call. I think the way it workd came from the DSL camp arguing that you should be able to make i…

>done just as nice with a properly named function call. So instead of view = projection * model; you would prefer. view.SetVector(Multiply3x3matrixWith3x1Vector(projection.GetMatrix(),model.GetVector()); Should we allow floats an doubles to be multiplied with a'*' or should that use properly named classes

Actually, you sort of prove my point there.

How does someone looking at the code know which parts of projection and model get multiplied here ?

At least make it:

     view.setVector(projection.getMatrix() * model.getVector());
Because '*' applied to a model or a projection could literally mean anything, there might be many elements in those structures that are candidates for multiplication.

By making it explicit what gets multiplied the code is less clear than it could be.

If they're simple arrays without further fields attached to them then you could do:

    view = matvecmul(projection,model);
And that's pretty close to the overloaded example.

Re: C++ in Coders at Work

#167
Of course it's going to be more convoluted then newer languages like Java: Java doesn't have to maintain backwards compatibility with a 35+ year old programming language. That's just stating the obvious.

Yet for some reason people still use it. The question is 'why'. For many cases (not all though), I think the reason is largely just institutional inertia - you stick with the devil you know rather than the devil you don't know.

Re: C++ in Coders at Work

#168

Earlier quoted context omitted.

I think C models how the computer works a lot more closely than C++ (and no one would argue that C isn't carrying water out in the engineering world even today). IMO C++'s issue is precisely that it layers all of these leaky abstractions on top of the strict procedural model of C. For my money, developers are better off knowing two tools (c + some very high level language) rather than the spork which is C++.

I remember 'cfront', when it first came out, and to this day I haven't really changed my mind on how I felt about it, it's a much too bloated language compared to the elegance of C. If 'C' would have had a decent native string type I think C++ might not have happened ;)

c + lisp, in my case. nice way to write DSLs.

Re: C++ in Coders at Work

#169
post #145

Earlier quoted context omitted.

>done just as nice with a properly named function call. So instead of view = projection * model; you would prefer. view.SetVector(Multiply3x3matrixWith3x1Vector(projection.GetMatrix(),model.GetVector()); Should we allow floats an doubles to be multiplied with a'*' or should that use properly named classes

Actually, you sort of prove my point there. How does someone looking at the code know which parts of projection and model get multiplied here ? At least make it: view.setVector(projection.getMatrix() * model.getVector()); Because '*' applied to a model or a projection could literally mean anything, there might be many elements in those structures that are candidates for multiplication. By making it explicit what gets…

The point is that there are fixed rules in Maths for what happens when you multiply 3x3 matrix by a 3x1 matrix and if this is even possible. Those should be enforced by the person writing the library's overloaded features not be left to the programmer to know which is the appropriate function to call.

Multiplying matrices is no more weird than multiplying a float by an int or a positive and negative number.

Re: C++ in Coders at Work

#170

Earlier quoted context omitted.

AutoCAD is not written in Lisp. It has been written in several languages, including C. AutoLisp is just a thin scripting layer. See the" rel="nofollow">http://www.fourmilab.ch/autofile/www/autofile.html>the autodesk file .

That 'thin' scripting layer has been used to program some pretty impressive stuff in the engineering and architectural world. Anyway, some more examples then: http://www.cliki.net/Application

> That 'thin' scripting layer has been used to program some pretty impressive stuff in the engineering and architectural world.

Yes, I've seen people work wonders with AutoLisp. There was - probably still is - an application used for designing clothes. The designer creates, I think, a "size 8" and a lisp script generates the other sizes.

AutoLisp being lisp-like is really a happy accident. The Autodeskers chose Xlisp IIRC because it was free and embeddable. If they could have embedded a C-like language interpreter, they would have.

In fact later, AutoDesk introduced other languages and tried to push users onto them. But AutoLisp already had huge momentum.

Post reply on HN