From: Jean-Marc Bourguet on 24 Nov 2006 05:42 "Terry G" <tjgolubi(a)netins.net> writes: > Doesn't most hardware reasonably define these operations, Yes. For example, providing no instruction with a signed shift count is a very reasonable approach for hardware. > so that the runtime impact isn't quite so severe? The reasonable definition above doesn't help here. > That's not rhetorical. I don't know. Hardware should behave better too. Perhaps a more important problem is that there are several options for the hardware in defining the behavior (or just preventing it to being an issue like above). And different processors have taken different approaches. Yours, -- Jean-Marc [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Nicola Musatti on 24 Nov 2006 05:45 Francis Glassborow wrote: > In article <75ydnaz-Vbll-f_YnZ2dnUVZ_ridnZ2d(a)comcast.com>, AJ > <two(a)haik.us> writes > >I think I agree, though I also think we need a clear definition of a > >"library" and of "core-language" support. It is unclear at this point > >whether a library can be "magic" in the sense that it does things a > >regular user couldn't. > > I am struggling to see how things like malloc can be implemented without > 'magic'. It is a fundamental principle of the C library, and hence the > C++ one that Standard Library elements can be implemented any way the > implementor chooses and that includes compiler 'magic.' Had you mentioned I/O I would have agreed, but in principle an implementation of malloc that obtained memory from a huge static array would be standard compliant. On systems that only assign virtual memory to a process on the first actual access it might even work acceptably. Cheers, Nicola Musatti -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: kwikius on 24 Nov 2006 17:24 > The out-of-the-box answer would be to look into ways to give programmers > abilities on a par with the compiler writers', and to solve the issues > that accompany that route. That would make news. "Language X adds infix > operators to the core" is not noteworthy. "Language X allows optimal > user-defined operators" would be. C++ strikes me as very much a language that gives you similar ( maybe simplified) components to the main components available to the compiler writer. Initialisation of a user defined object, copying, cleanup of an object and operators are all under the programmers control. I got the impression that is one part of what Bjarne Stroustrup was trying to achieve , making public abstractions and the essential, necessary, primitive operations for arbitrary types rather than keeping them hidden so restricting "types with a comprehensive set of operations" to the few provided in a language. Surely C++ is a kind of high level compiler writers kit, hence the large number of domain specific languages written in C++. There is some loss in performance from using UDT's but that is a tweak, rather than a flaw. regards Andy Little -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Francis Glassborow on 24 Nov 2006 17:29 In article <1164363149.369236.29340(a)h54g2000cwb.googlegroups.com>, kwikius <andy(a)servocomm.freeserve.co.uk> writes >C++: > >std::cout << 1 * (2 + 3) / 4 ; > >FORTH: > >1 2 3 4 + * / . Actually: 1 2 3 + 4 / * . But that does illustrate the problem, by the time we reach adulthood using RPN is very strange and hard work. However that is a product of our educational systems (I spent five years using Forth for introducing programming 14-16 year olds in a UK Comprehensive school. None of my pupils had any problems with reverse Polish though some of their parents did :-) One major problem is that in order to introduce something that is substantially different to the norm we have to find teachers for it. Lisp has largely failed for that reason (yes I know it is widely used in some areas) LOGO has largely failed for similar reasons (despite being an excellent general educational tool) One school local to me used to have Chinese on its curriculum but had to abandon it about five years ago because they could not find a qualified teacher for their courses. One reason for the popularity of Java is that it seems easier for the teacher and the aplets provide the instant gratification that students seem to need. That last element is why I provided very simple graphical support for C++ for those adopting my books as a source of learning C++. I also note that successful books on Haskell and Python do something similar. I wish I could find a simple and ideally portable, music library (i.e. one in which the programmer can easily generate code to drive a sound card) for C++. One ingredient for success is that there need to be sufficient teachers who at least think they can teach the language. This almost always favours new languages because it takes time for the problems to surface. I do wish that teachers would realise that it is quite unnecessary to deal with all the special case and corner cases when teaching C++ (or any other language) 101. For example, by avoiding pointers you avoid a whole problem area until the student has a sound general understanding of programming. It seems too often that teachers and writers delight in making learning difficult by what they choose to teach. Among other things I teach introductory Bridge courses, and one thing we steer clear of is how to deal with wild distributions (well at least until the students have sound methods for more normal hands) -- Francis Glassborow ACCU Author of 'You Can Do It!' and "You Can Program in C++" see http://www.spellen.org/youcandoit For project ideas and contributions: http://www.spellen.org/youcandoit/projects [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Francis Glassborow on 24 Nov 2006 17:26
In article <yt6dneDHQou8kvvYnZ2dnUVZ_sednZ2d(a)comcast.com>, Walter Bright <walter(a)digitalmars-nospamm.com> writes >If Forth is so powerful, why has it remained an obscure niche language? There are a number of languages that are very good in the hands of someone who understands them (and are even teachable to novices as long as the teacher has a fundamental understanding of programming and how the chosen language supports those fundamentals). APL is a classic example of a niche language that is exceptionally powerful in its problem domain (computational mathematics). SNOBOL is another very interesting language with tremendous power but which fails to mesh easily with the thought processes of the average computer user. Lisp is another powerful language which suffers from problems with the average programmer (and unfortunately with too many trying to teach it). Then there are all the functional languages such as Haskell. What makes a language popular and widely used? Well why is English the commonest second language in the World. It is a terrible language full of special cases. Nonetheless (note that almost Germanic concatenation of three words :) ) it is widely used for communication whilst such specially designed languages as Esperanto languish in small niches (I am told that Esperanto is an excellent intermediate language for translation between minority languages, e.g. you are unlikely to find someone who is bilingual in Welsh and Hindi, but you have a fair chance of finding an Esperanto speaking Welsh speaker and another speaking both Esperanto and Hindi. So if you want to translate a Welsh novel to Hindi that offers a viable route) In a similar vein C++ is a good general purpose language despite (or perhaps because of) its idiosyncrasies. Of course you have to understand what you are doing and C++ will provide much less nannying because being multi-paradigm requires that it trust the programmer. D may well be a much better multi-paradigm language but currently it IS a niche language (though that might change). OTOH C++ continues to develop and add support for more programming requirements. The current work on a new abstract machine to better match today's common hardware is an example of the attention being given to low-level requirements. The ongoing work on Concepts will benefit library writers and those working on generic and metaprogramming. Modules (which will probably be tried as a TR because we have too much else to do for C++0x) is an example of work motivated by the need to make things easier for the end user of the language. We have a choice between putting effort into improving what we already have or starting over when we want to design a cross-platform language. Note that neither C# nor Java fall into that group because both aim at a (virtual) platform and transfer issues of portability to a virtual machine. The problem is that not all hardware can comfortably support the required VM efficiently (for example any hardware whose native types mis-match Java's has to sacrifice low-level efficiency. What makes a good new language? I doubt if anyone can say. What history suggests to me is that any new language that becomes popular because it addresses some perceived problems with a widely used existing language acquires an exponentially rising number of users (and advocates and devotees). After it has been in use for five-ten years the problems hidden in the design begin to surface and become increasingly more irritating (the strengths of the language are then forgotten because they are just assumed) Languages need to be durable, or at the very least able to easily assume responsibility for source code written in a predecessor. If not that they usually need a familiar syntax and semantics so that adoptees do not have to steep a learning curve. Finally we should be careful about comparing like with like. The interesting features of languages like Ruby and Python is that the come from a very different ancestry (that of scripting languages) -- Francis Glassborow ACCU Author of 'You Can Do It!' and "You Can Program in C++" see http://www.spellen.org/youcandoit For project ideas and contributions: http://www.spellen.org/youcandoit/projects [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |