Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Best/Favorite coding program
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Fri Feb 08, 2013 5:01 am    Post subject: Reply with quote

wcg wrote:
I still install ed. You never know when a "make test" from the dawn
of time in some .tar.gz that you found in an obscure ftp archive
is going to want it.

Not surprisingly, texlive depends on it.

Quote:
(It is up to 48k on 64-bit x86; sheesh, "bloat!")

The bloat comes from using C, which is super high-level with its loops and static typing. app-editors/e3 is written in assembly (as God intended), and uses only 17KB despite emulating five other editors.
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2280
Location: Adendorf, Germany

PostPosted: Fri Feb 08, 2013 8:24 pm    Post subject: Reply with quote

dysoco wrote:
Why not Gedit/Kate instead of Sublime? Well, I also run Windows, so I like to have the same software in all my OS/PCs.
*If* (and only if) you'd like Kate better than Sublime, you might like to test KDE on Windows. You'd have to live with the library dependencies, but I use it to have (some) KDE apps on Windows to round the Cygwin stuff off.
Hypnos wrote:
wcg wrote:
I still install ed. You never know when a "make test" from the dawn
of time in some .tar.gz that you found in an obscure ftp archive
is going to want it.

Not surprisingly, texlive depends on it.
Not only. ;)
Code:
 $ equery d sys-apps/ed
 * These packages depend on sys-apps/ed:
app-text/texlive-core-2011-r7 (sys-apps/ed)
net-misc/curl-7.26.0 (sys-apps/ed)
sys-devel/patch-2.6.1 (test ? sys-apps/ed)
virtual/editor-0 (sys-apps/ed)
Hypnos wrote:
Quote:
(It is up to 48k on 64-bit x86; sheesh, "bloat!")

The bloat comes from using C, which is super high-level with its loops and static typing. app-editors/e3 is written in assembly (as God intended), and uses only 17KB despite emulating five other editors.
Oh *meh*. Assembly speed = C/C++ as C/C++ are compiled into assembly code. You might end up slightly faster with hand wrtitten assembly, but that is really hard to master. And thanks to modern compilers optimzation the results aren't noticeable on modern hardware. The difference is that C and C++ are much faster to develop while assembly is much better for custom processors.
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Fri Feb 08, 2013 8:57 pm    Post subject: Reply with quote

Yamakuzure wrote:
Oh *meh*. Assembly speed = C/C++ as C/C++ are compiled into assembly code. You might end up slightly faster with hand wrtitten assembly, but that is really hard to master. And thanks to modern compilers optimzation the results aren't noticeable on modern hardware. The difference is that C and C++ are much faster to develop while assembly is much better for custom processors.
Writing assembly in the right circumstances can result in code that's dramatically faster. That said, writing a whole editor in assembler is an enthusiast's project, not a practical one. Under slightly narrower circumstances, I'll second the, "Meh." :wink:

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Fri Feb 08, 2013 10:00 pm    Post subject: Reply with quote

Quote:
The bloat comes from using C, which is super high-level with its loops and static typing. app-editors/e3 is written in assembly (as God intended), and uses only 17KB despite emulating five other editors.

god bless, it seems like real coders aren't dead yet..!! nowadays C is seen as a very low level language, but I always thought: why is "for (int i = 0; i < n; ++I)" lowlevel? I mean it's already very abstract! :)

On one hand I like logic programming languages (ok, I admit: the idea of logic programming, because I didn't wrote a single line till now :) ) and OO-style, because I think it's a "realization" of set theory in the sense that a class is a set and objects are it's elements, but on the other hand are real low level languages closer to mathematical logic and moreover closer to the hardware. It was a hard decision for me to go with computer science or with electronics (computer science won), because electronics / hardware is the thing that makes all this possible ( of course one can say: "no mathematics makes it possible, or software makes it possible, etc, etc" ). I really hate it that most people want to abstract so far that they don't want to learn assembly anymore (even this is abstract in the sense that you write things like "mov" etc and then something happens, if you know what I mean).

Do you think its convenience or are there serious reasons (besides that assembly isn't portable) ?
I always say that people that don't want to bother with machines should study mathematics, then you can abstract! :)

EDIT: C/C++ is translated into assembly of course, but not one to one. Even Java and everything that runs on a computer is translated into machine languages, but assembly language is to only language with a "one-to-one" match to machine language...
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Fri Feb 08, 2013 11:01 pm    Post subject: Reply with quote

Yes, assembler isn't portable and that's a major reason. However, the most important reason is productivity:
  • You can express ideas more quickly in something more abstract. More running code per man hour spent.
  • High level languages are fast enough for most purposes.
  • Memory is cheap.
So, total cost of ownership is lower.

<Rant>
By the way, where did this term "coder" come from? I see it more and more. Do we not aspire to design, to engineer solutions? Merely coding is a subset of the skills that we must bring to bear.
</Rant>

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Sat Feb 09, 2013 12:09 am    Post subject: Reply with quote

Quote:
Yes, assembler isn't portable and that's a major reason. However, the most important reason is productivity:

You can express ideas more quickly in something more abstract. More running code per man hour spent.
High level languages are fast enough for most purposes.
Memory is cheap.

So, total cost of ownership is lower.


I accept only the first reason, the second and third are only economic or "practical" (in the sense that it's good enough, but one can always do it better and therefore obviously there has to be a better solution...)

What I don't understand (maybe I will laugh about myself in a year :) ) is why it is not possible to develop a high level language that is like macros of assembly-commands and therefore also a one to one match to machine code?
I've recognized in many of my programs (C, C++, Eiffel) that the sequence of commands in my source code is not equal to the really executed sequence. I guess the compiler optimized something?!

It's evident that one can't (or not good) express ideas in assembly language, but is it not only because we are not adapt to this? I'm reading always stuff like: programming languages are more precise, but also limited in "expression-power", but in "natural languages" we can't really express our ideas too.

I mean obviously all our programmed ideas are in the end additions or better expressed in sequences of zeros and ones.

Quote:
<Rant>
By the way, where did this term "coder" come from? I see it more and more. Do we not aspire to design, to engineer solutions? Merely coding is a subset of the skills that we must bring to bear.
</Rant>


I don't know exactly from where the term comes (I've read because in times of assembly - machine languages one had to "code" an idea in a cryptic language). I use the term because I like it and it's shorter than programmer. Bertrand Meyer wrote in one of his books that it's a deprecatory term, because a "coder" is someone that only types in ideas from other, but I disagree.
Of course programming/coding is a subset of our skills, but it's maybe the most important one (maybe not, I don't know) and it's the skill that separates us most from other engineering / mathematical disciplines.

maybe one should say: hacker, coder, architect and debugger :)

EDIT:
One "practical" reason for low level languages is that the more abstract it gets the more you are away from the actual problem / machine, so it gets harder and harder to recognizes where a bug is because the program that is executed is maybe far away from the source code, or do I see this wrong?
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Feb 09, 2013 1:15 am    Post subject: Reply with quote

The language you're looking for is C. :P When originally conceived, every native operator mapped directly to a machine instruction. Even the pre/post increment/decrement operators were side-effects of the addressing modes of individual machine instructions. For instance,
Code:
a = *c++;
was often a single machine instruction.

In the professional world, better is often the enemy of good enough. But, thinking that programming in assembly language is always better ignores all other metrics besides code size and execution speed. Like it or not, programmer productivity is an important metric. Even more important is maintainability. Higher level languages have the structure and paradigms to make for better readability and long-term maintainability.

"Coder" is somewhat of a hot button for me, in a negative way. We write in programming languages, which have statements and expressions. It's even called assembly language. The major tools of our trade compile or assemble these languages and emit object code which is then massaged into machine code at (ultimately) run time. I do not code. I'm a programmer, a software engineer, a designer, an architect. (And, perhaps, somewhat pretentious.:P But I think it's worth the extra syllables.)

I think you'll also eventually find that computer science, while a fine and worthy discipline, is often not sufficient. You need one of those other disciplines in order to understand real world problems who's solution can be contributed to by your computer science skills.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Sat Feb 09, 2013 1:44 am    Post subject: Reply with quote

Quote:
The language you're looking for is C. :P When originally conceived, every native operator mapped directly to a machine instruction. Even the pre/post increment/decrement operators were side-effects of the addressing modes of individual machine instructions.

And now this isn't the case anymore?

Quote:
In the professional world, better is often the enemy of good enough. But, thinking that programming in assembly language is always better ignores all other metrics besides code size and execution speed. Like it or not, programmer productivity is an important metric. Even more important is maintainability. Higher level languages have the structure and paradigms to make for better readability and long-term maintainability.

Yes I admit thats true, not even only in the professional world. I mean you want to be as fast / productive in everything that you do...
Although it's true that higher level programs are better to maintain, I think this is only a matter of adaption. Ok, maybe not only but the structure of C may be enough...

Or we should build machines that operate different from the current ones :)

Quote:
"Coder" is somewhat of a hot button for me, in a negative way. We write in programming languages, which have statements and expressions. It's even called assembly language. The major tools of our trade compile or assemble these languages and emit object code which is then massaged into machine code at (ultimately) run time. I do not code. I'm a programmer, a software engineer, a designer, an architect. (And, perhaps, somewhat pretentious.:P But I think it's worth the extra syllables.)

I think I know what you mean: for you is coding writing in machine language ?! and to program is writing in a higher language? But every language consists of a set of symbols and rules to operate with those symbols, therefore I see no difference in "coding" and "programming".

Quote:
I think you'll also eventually find that computer science, while a fine and worthy discipline, is often not sufficient. You need one of those other disciplines in order to understand real world problems who's solution can be contributed to by your computer science skills.

Yes I agree, but I would like to know everything and be able to do everything, but it's just not possible. So one have to learn as much as possible. I want to learn as much as possible about electronics (which is not a major topic in Computer Science anymore). Or do you mean disciplines like economy, etc?
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Feb 09, 2013 2:35 am    Post subject: Reply with quote

No, to me "coder" is a synonym for "hacker", as in a hack programmer. Negative connotations for me.

What I mean by those other disciplines is this. Are you going to write all of your programs in the furtherance of the field of computer science? Or is it more likely that you'll be assisting in some other field: physics, biology, engineering (structural, mechanical, electrical, aerospace), economics, business, law. Some knowledge of that other field would be helpful, yes? Now there are pure computer science specialties, too: compiler design (in particular), software tools development (in general), database, operating systems. However, there are fewer specialties here and fewer jobs in the real world.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Sat Feb 09, 2013 2:37 am    Post subject: Reply with quote

* curl's dependency on ed has been removed going forward.

* I'm glad that my lighthearted trolling has sparked a discussion. BTW, I was only claiming that machine code from C is bigger than from assembly, not faster.
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Feb 09, 2013 2:51 am    Post subject: Reply with quote

LoTeK wrote:
And now this isn't the case anymore?
It's still mostly the case. ;)

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Sat Feb 09, 2013 4:59 am    Post subject: Reply with quote

LoTeK wrote:
What I don't understand (maybe I will laugh about myself in a year :) ) is why it is not possible to develop a high level language that is like macros of assembly-commands and therefore also a one to one match to machine code?

Welcome to C. (As J.R.G. already mentioned.)

The question is, "which machine?" "Which assembler?"

Charles Babbage's difference engine, the Engima machine, old IBM mainframes (with punch cards), minicomputers, and, now, multicore X86 all have very different characteristics from the others. A low-level language optimized to any one of them would probably not be particularly well-suited for the others.

That said, the industry seems to have stabilized on an 8-bit byte and binary arithmetic for a couple of decades now. So there's a lot of common ground, which the C language more or less captures well, particularly in recent years now that compiler technology has improved sufficiently to actually use the opcodes as intended. It isn't always one-to-one even in the best case. c = *p++ might be one opcode on a certain class of machine, but it might take two on another. But on the other, perhaps c = p[i] is one opcode, and the eventual i++ can be amortized over several such array references as well as serving to control the loop. The best compilers can transform between the two and use the most effective form for the machine running it.

It is interesting and very educational to write those first few programs in assembler. But after a while it starts to get tiring. There's just too many irrelevant details. Need to call a function? What registers is it using? Which registers are you're using now? Maybe some need to be saved and restored. Perhaps it's worthwhile to re-do the function to use different registers so it doesn't collide as much... all those things are pretty much arbitrary but it's annoying to constantly be keeping track of what's being used where. And if you give up and just say "well I'll only use registers in this way", you run the very real risk that the compiler out-performs you, since it doesn't mind keeping track of all the details.

Sure, there's things I can do in assembler that I wish I could do in C. The most common being, several different functions all end with identical code. In assembler you can code that common part once and have the functions all do their thing and then jump to the common portion.

In C this is expressed as
Code:
int common_part(...args...) {
    return ...whatever...;
}

int f(...) {
    ...stuff_specific_to_f...;
    return common_part(...args...);
}
This involves an additional procedure call and furthermore could force f() to generate stack-frame and register save/restore code where otherwise it might not have needed to.

But even this, recent versions of gcc now know how to optimize out. The compiler sometimes generates a jump to the common portion, exactly as I might have done in assembler. You need to be aware of what and how it does so. (Specifically, the called function and its parent need to have identical stack clean-up code — which generally means identical argument signatures — so that the return from the second also works when used as a return from the first.)

With some care and judicious use of gcc -O2 -S and viewing of the generated code, it's not hard to pick up what works well and what doesn't. And I've even discovered bugs while doing this: "what's that opcode doing there, it shouldn't be doing this" ... "Oh! there's a bug in my code!

Quote:
One "practical" reason for low level languages is that the more abstract it gets the more you are away from the actual problem / machine, so it gets harder and harder to recognizes where a bug is because the program that is executed is maybe far away from the source code, or do I see this wrong?

See above :)

I've found the gcc -O2 -S view-the-assembler-output trick particularly helpful in visualizing C++ programs. Wrong virtual being called? Oh! I see it's calling it statically, I must have forgotten a 'virtual' keyword somewhere in there. Doing this regularly (but not fanatically) during development goes a long way toward making sure there's no inadvertent bloat creeping in on account of using features you might not have meant to. And it's much easier to inspect compiler output every now and then, than to code the whole thing yourself in assembler (even if on occasion what you see results in mouthing a few salty words).

John R. Graham wrote:
LoTeK wrote:
And now this isn't the case anymore?
It's still mostly the case. ;)

But there's an important class of hardware that's becoming very common, that I feel needs better support: graphics cards and massively parallel algorithms. Interesting times, that vector can now properly be an assembler-level fundamental data unit.
_________________
Many think that Dilbert is a comic. Unfortunately it is a documentary.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Feb 09, 2013 1:38 pm    Post subject: Reply with quote

Indeed. There are two classes of machine that I aspire to build for myself, just for the broadening learning experiences:
  • First, massively parallel. Do you know that nVidia Tesla cards with a mere 1k cores and a paltry teraflop or so of performance are available used now for only a few hundred dollars? I'm currently planning out my own baby supercomputer.
  • Second, VLIW. Not so long ago, I thought that Itanium was going to take the world by storm. It just made so much more sense to decide which pieces of code could be run in parallel at compile time. Massive die area advantages, too, which is, of course, synergistic with potential clock speed. I want to get some first hand knowledge of what assembler looks like on that.
There's always more to learn. :D

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Sat Feb 09, 2013 3:31 pm    Post subject: Reply with quote

Quote:
It is interesting and very educational to write those first few programs in assembler. But after a while it starts to get tiring. There's just too many irrelevant details. Need to call a function? What registers is it using? Which registers are you're using now?

I can imagine that this is very true! I insisted on not using a makefile and I always typed the compiler flags/option by myself, but after a few times I've seen it and now I'm using a makefile :)
But I just have this feeling that we can do more and more stuff a a whole but less and less as an individual. For example Charles Babbage build his difference engine by himself and I can't build my computer even when I had the materials. And when you program only in java / python etc then you understand less and less how the whole system works, or do you disagree?

Quote:
And if you give up and just say "well I'll only use registers in this way", you run the very real risk that the compiler out-performs you, since it doesn't mind keeping track of all the details.

But I thought that the compiler must keep all details? "Someone" has to keep them, because otherwise it won't work?!

Quote:
I've found the gcc -O2 -S view-the-assembler-output trick particularly helpful in visualizing C++ programs.

I didn't know this trick, thanks..

Quote:
There's always more to learn. :D

yes, this is good and at the same time bad :)

btw, why does the shell use 0 as exit codes for successful termination? and C uses 0 as false?
A question in the first chapter in "introduction to 64 bit intel assembly language programming for linux" :)
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Feb 09, 2013 6:08 pm    Post subject: Reply with quote

It's not inconsistent at all. Many, many C library functions use 0 as the "success" result. Think of it not so much as true & false as the answer to the question "any errors?". Zero means false, means no errors, means success. ;)

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 547
Location: NRW, Germany

PostPosted: Sun Feb 10, 2013 1:26 am    Post subject: Reply with quote

LoTeK wrote:
But I just have this feeling that we can do more and more stuff a a whole but less and less as an individual. For example Charles Babbage build his difference engine by himself and I can't build my computer even when I had the materials. And when you program only in java / python etc then you understand less and less how the whole system works, or do you disagree?

That is how the world works. You did not build your house, you did not build your car. Things are complicated. People work hard to make complicated things simple to use. Building something from these simple things is either trivial or complicated again. Repeat.

LoTeK wrote:
What I don't understand (maybe I will laugh about myself in a year :) ) is why it is not possible to develop a high level language that is like macros of assembly-commands and therefore also a one to one match to machine code?

That is C.
Thinking about it some high level languages like Haskell used to compile to C.

LoTeK wrote:
Quote:
Yes, assembler isn't portable and that's a major reason. However, the most important reason is productivity:

You can express ideas more quickly in something more abstract. More running code per man hour spent.
High level languages are fast enough for most purposes.
Memory is cheap.

So, total cost of ownership is lower.


I accept only the first reason, the second and third are only economic or "practical" (in the sense that it's good enough, but one can always do it better and therefore obviously there has to be a better solution...)

Those are not three reasons. All those are three facts and they are one reason.
You save development time and pay with runtime and memory. It's a tradeoff and it's up to you to decide what's best for the job.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Sun Feb 10, 2013 2:56 pm    Post subject: Reply with quote

C++ deprecated: http://landley.net/notes-2011.html#16-03-2011
C -> scripting languages: http://landley.net/notes-2011.html#19-03-2011
(The shortest www server I ever saw was written in two pages of common lisp.
It was not big on whiz-bang new features, but it worked.)
The OO tangent: http://landley.net/notes-2011.html#20-03-2011

So, much as I like stream of data editors that fit in a cache line,
there is something to be said for letting the language runtime handle
allocation, deallocation, and data type management.

I read about a DARPA project in the late 1970s that needed
a custom realtime OS for some embedded hardware on a missile
or satellite. The project took the approach of describing the
instruction set of the device's cpu and its constraints, the response
times of its circuits, and the timing requirements of the OS in lisp.
Then they ran the lisp program, and it generated the OS in machine
language for the target pocessor. It worked. No crashes, no priority
inversions, no problems. So Computer Science, which evolved functional
languages like lisp, is not without benefits. The runtimes for
those languages are not really cache-friendly, typically, so performance
tends to be a secondary consideration.

(If you did that for a modern pc or server, the hardware would
likely be obsolete before you finished the lisp program. Think of
how many kinds of hardware you would have to describe to
generate the linux kernel in machine code.)
_________________
TIA
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Sun Feb 10, 2013 7:05 pm    Post subject: Reply with quote

Quote:
That is how the world works. You did not build your house, you did not build your car. Things are complicated. People work hard to make complicated things simple to use. Building something from these simple things is either trivial or complicated again. Repeat.

Yes I know, but it's depressing. It's like the old manufacturers that build a whole product vs ford-industry where you just build a small part. I know of course that ford can produce way more cars (maybe even better cars) this way, but I think it's not healthy for our soul.

Quote:
That is C.
Thinking about it some high level languages like Haskell used to compile to C.

Eiffel compiles to C too.

Quote:

Those are not three reasons. All those are three facts and they are one reason.
You save development time and pay with runtime and memory. It's a tradeoff and it's up to you to decide what's best for the job.

I'm just thinking about the "memory is cheap fact": As far as I know is one of the main reasons for introducing floating point numbers that they can express a far greater domain of numbers with the same amount of bits than integers. But they have several drawbacks for example that mathematical laws like associativity of numbers doesn't hold anymore etc. So if memory is so cheap, aren't integers "better" than floating point numbers?

@wcg
I've read that stallman programs mostly in C or lisp and that he recently programed a little in java and said that it looks like a good C successor and on the other hand that he found C++ pretty ugly. Moreover is C++ a very large language compared to C, but isn't it even so the "best" O-O language, because it's OO and has C as a subset?
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 547
Location: NRW, Germany

PostPosted: Sun Feb 10, 2013 10:30 pm    Post subject: Reply with quote

Oh and I have some reading for you, Lotek.
I like the entire book, and I wholeheartedly recommend reading it, but these two chapters are especially relevant for the discussion here.
http://catb.org/~esr/writings/taoup/html/ch01s06.html#id2878666
http://catb.org/~esr/writings/taoup/html/languageschapter.html
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Mon Feb 11, 2013 3:17 am    Post subject: Reply with quote

LoTeK wrote:
@wcg
I've read that stallman programs mostly in C or lisp and that he recently programed a little in java and said that it looks like a good C successor and on the other hand that he found C++ pretty ugly.

Stallman has his opinions, as do others. Form your own.

Quote:
Moreover is C++ a very large language compared to C, but isn't it even so the "best" O-O language, because it's OO and has C as a subset?

* C++ is not a superset of C

* However, Objective-C is a strict superset, and is a full-fledged OO language with a far simpler syntax. It's OO model uses dynamic dispatch, opening the door to runtime substitution of objects and metaprogramming. (For better or for worse ...)
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Mon Feb 11, 2013 11:24 am    Post subject: Reply with quote

I always thought C++ overloading C operators was the language design
maliciously hassling me. I did not have theoretical reasons for disliking
it, I disliked it for being harder to picture what was happening in the code
for no good reason, and for having to write more setup code (classes,
etc) before I could write the code that would actually manipulate the data
that I wanted the program to manipulate.

I did not even like C, really. It was too cryptic. I learned it *painfully*,
by programming with it. Hands on control of memory allocation is a
big win in kernel space. It is also a win in userspace where things
run frequently or constantly (daemons, heavily used shared libraries).
Where script interpreters are fast enough for the task in hand, that
becomes annoying programmer overhead. C is a bit like pick and
shovel mining: you dig a hole in the earth, find a gold seam, but there
is no room to swing your pick to dig it out. Before you can start doing
what you came for, first you have to dig out a big chunk of earth behind
you with nothing of value in it to make room to work. That is C. (And
that is C++, too, only worse, imho.)

I like languages that are easier to read than C. As languages have
evolved, the language designers of the compiled languages that
became heavily used always seemed to have a different concept
of "better" than I did. So I tend to discard them and just use C,
because it can do whatever their new syntax and semantics can
do, I already know it, and gcc already knows it. (The fact that
the C program is usually smaller and faster is a bonus.) "If it is not
easier to read than C, why bother with it?"
_________________
TIA
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2280
Location: Adendorf, Germany

PostPosted: Mon Feb 11, 2013 12:16 pm    Post subject: Reply with quote

Oh for heavens sake, this is completely futile. Real men write machine code using punch cards! Seriously, the reason why ASM exists is, that you do not *have* to write machine code any more (coder) yourself. And the reason why higher level languages exist is, that you do not *have* to write ASM any more.
This does not mean that you can't if you need to.
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
LoTeK
Apprentice
Apprentice


Joined: 26 Jul 2012
Posts: 270

PostPosted: Mon Feb 11, 2013 1:04 pm    Post subject: Reply with quote

Quote:
* C++ is not a superset of C

I didn't know that..

Quote:
Oh and I have some reading for you, Lotek.

Thanks, I'm reading right now :)

Quote:
I did not even like C, really. It was too cryptic. I learned it *painfully*,
by programming with it.

Well I love this cryptic syntax and the language is small, therefore manageable. I've read somewhere that "C is god own programming language". Although I wouldn't go that far it's beautiful how much you can do with pointers, arrays and structs. And if you want to change / modify / hack linux source code there is no other way! But using C for applications is maybe not justified anymore, although I know someone that do application programming in C in his company because it would be too expensive to switch to java etc.

You maybe like Ada / Eiffel syntax...

Quote:
Real men write machine code using punch cards!

Real programmers use stationary lasers on the moon to flip the desired bits..

Quote:
This does not mean that you can't if you need to.

yes but only if you use them from times to times, otherwise you will forget it...
_________________
"I want to see gamma rays! I want to hear X-rays! Do you see the absurdity of what I am? I can't even express these things properly because I have to conceptualize complex ideas in this stupid limiting spoken language!"
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Mon Feb 11, 2013 10:11 pm    Post subject: Reply with quote

From http://catb.org/~esr/writings/taoup/html/ch01s06.html#id2878666

Quote:
But there are no ‘small systems’ any more, not in mainstream applications
programming. Under today's conditions, an implementation language that automates
away memory management (and buys an order of magnitude decrease in bugs
at the expense of using a bit more cycles and core) makes a lot more sense.


Actually the first statement is not true. Embedded systems,
which qualify as "small systems" in the sense used in this
document (slower processors with small memory), outnumber
desktop and server operating systems by orders of magnitude.
Maybe these are not "mainstream applications programming",
but C and assembler have vast markets for which they are
more appropriate than higher level languages.

Quote:
the language is small, therefore manageable


I do not particularly like the cryptic syntax, but if that is all we
have, "small and manageable" is a lot better than "large and unwieldy".

Ada/Eiffel: the syntax is not that bad, and I like the safety features.
Ada tends to lack C and the C standard library's easy character i/o.
Reading the Ada description, that part was clear as mud. ("If I have
to figure out by trial and error how to print 'hello world' on the console,
I'm outta here.") I thought Eiffel would have been a better choice than
C++ or Java for OO programming.

For the functional languages, it helps to picture a program from
the point-of-view of non-technical management. If you show them a
flowchart of how your program handles a task, they get that, maybe
with a little explanation of why it makes the choices it makes in
different situations. If you then show them a program in an operational
language, it looks like "wierd math", but if you explain briefly what
different statements do, they can see that the operations map to
the flowchart: gathering data, making choices, doing what the flowchart
says to do next in that case.

But if you show them a functional program and try to explain how that
maps to the flowchart, they are at sea. Set theory is not their thing.
It is something that they have a difficult time conceptualizing.
(Functional programming's tradition of treating i/o as something
disreputable or an afterthought, because it does not fit into
mathematically complete theoretical models, does not help in getting
people to use it for real-world tasks.)

Communicating a result to the user or to a device is every bit as
vital as computing it in the first place. Not making that easy and
obvious is bad programming language design, imho.
_________________
TIA
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Thu Feb 14, 2013 11:20 pm    Post subject: Reply with quote

:$
iI like qtcr^H^H-creator!
It gets a fake vi editing mode!ESCA I appreciate!ESCZZ
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum