www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Does functional programming work?

reply Walter Bright <newshound1 digitalmars.com> writes:
An interesting counterpoint to the usual FP hype:

http://prog21.dadgum.com/55.html
Dec 30 2009
next sibling parent retard <re tard.com.invalid> writes:
Wed, 30 Dec 2009 17:46:58 -0800, Walter Bright wrote:

 An interesting counterpoint to the usual FP hype:
 
 http://prog21.dadgum.com/55.html

The related reddit comments seem to have more value than the article (again, the author didn't really get his monads right): http://www.reddit.com/r/programming/comments/aje5b/ functional_programming_doesnt_work_and_what_to_do/
Dec 30 2009
prev sibling next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Walter Bright:
An interesting counterpoint to the usual FP hype:<

The right thing to do here is to learn a functional language (and its lingo) and to try to use it to write some programs. It's time way better spent than reading articles about functional programming :-) Bye, bearophile
Dec 30 2009
prev sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Walter Bright" <newshound1 digitalmars.com> wrote in message 
news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

Didn't read the original article, but the one being linked to is completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.
Jan 01 2010
next sibling parent reply Walter Bright <newshound1 digitalmars.com> writes:
Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message 
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

Didn't read the original article, but the one being linked to is completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I agree, the old programming-language-as-religion problem. I first ran into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.
Jan 01 2010
next sibling parent Mike James <foo bar.com> writes:
Walter Bright Wrote:

 Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message 
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

Didn't read the original article, but the one being linked to is completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I agree, the old programming-language-as-religion problem. I first ran into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.

You missed out on Delphi - IMO it gives C++ a good kicking ;->
Jan 01 2010
prev sibling next sibling parent reply Walter Bright <newshound1 digitalmars.com> writes:
retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 When I then picked up K+R C, I never wrote another line of Pascal. It so
 soured me on Pascal that I never got on the later bandwagons of Modula
 II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination. I fail to see Pascal as a religion. I don't know what the pure Pascal compiler you're talking about is, but ordinary Pascal is just another procedural systems programming language like C. It has a bit different syntax ("begin end" vs "{}" and so on), somewhat different rules for some default data types, but it's more or less C wrapped in a syntactic mask.

Pick up a copy of "Pascal User Manual and Report." That's pure Pascal. It's also quite useless. Your program has to be all in one file, for instance. For another, writing I/O always appends a newline. Try writing binary files with that. There was no way to get at the bit representation of a type. Etc.
Jan 03 2010
parent reply grauzone <none example.net> writes:
Walter Bright wrote:
 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 When I then picked up K+R C, I never wrote another line of Pascal. It so
 soured me on Pascal that I never got on the later bandwagons of Modula
 II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination. I fail to see Pascal as a religion. I don't know what the pure Pascal compiler you're talking about is, but ordinary Pascal is just another procedural systems programming language like C. It has a bit different syntax ("begin end" vs "{}" and so on), somewhat different rules for some default data types, but it's more or less C wrapped in a syntactic mask.

Pick up a copy of "Pascal User Manual and Report." That's pure Pascal. It's also quite useless. Your program has to be all in one file, for instance. For another, writing I/O always appends a newline. Try writing binary files with that. There was no way to get at the bit representation of a type. Etc.

That's all gone in modern Pascal dialects. Delphi is very similar to D; it's practically a Pascal version of D. The OOP features are the same, except for some small differences, which make Delphi a bit more flexible (virtual and named constructors...). The only thing that was really lacking in Delphi are templates. But for compensation, it had powerful RTTI. Try writing a reflection/serialization mechanism in D that's as powerful Delphi's. I bet you won't succeed, not even with D2. (Need to fix some compiler bugs or deficiencies in the area of __traits first.) Even if you succeed, the end result will be probably harder to use. (If that sounds polemic, show me a D library that implements full serialization on Delphi/Java/whatever level, and I'll shut up.)
Jan 03 2010
next sibling parent reply Walter Bright <newshound1 digitalmars.com> writes:
grauzone wrote:
 Walter Bright wrote:
 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 When I then picked up K+R C, I never wrote another line of Pascal. 
 It so
 soured me on Pascal that I never got on the later bandwagons of Modula
 II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination. I fail to see Pascal as a religion. I don't know what the pure Pascal compiler you're talking about is, but ordinary Pascal is just another procedural systems programming language like C. It has a bit different syntax ("begin end" vs "{}" and so on), somewhat different rules for some default data types, but it's more or less C wrapped in a syntactic mask.

Pick up a copy of "Pascal User Manual and Report." That's pure Pascal. It's also quite useless. Your program has to be all in one file, for instance. For another, writing I/O always appends a newline. Try writing binary files with that. There was no way to get at the bit representation of a type. Etc.

That's all gone in modern Pascal dialects. Delphi is very similar to D; it's practically a Pascal version of D. The OOP features are the same, except for some small differences, which make Delphi a bit more flexible (virtual and named constructors...).

The problem was, in the 80's, pure Pascal was useless and so needed dialects. Every Pascal vendor added a boatload of extensions, all incompatible with each other. None had enough market share to create a de-facto standard. All this left a huge opening for C, and the rest, as they say, is history. The market window closed for Pascal.
Jan 04 2010
next sibling parent grauzone <none example.net> writes:
Walter Bright wrote:
 grauzone wrote:
 Walter Bright wrote:
 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 When I then picked up K+R C, I never wrote another line of Pascal. 
 It so
 soured me on Pascal that I never got on the later bandwagons of Modula
 II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination. I fail to see Pascal as a religion. I don't know what the pure Pascal compiler you're talking about is, but ordinary Pascal is just another procedural systems programming language like C. It has a bit different syntax ("begin end" vs "{}" and so on), somewhat different rules for some default data types, but it's more or less C wrapped in a syntactic mask.

Pick up a copy of "Pascal User Manual and Report." That's pure Pascal. It's also quite useless. Your program has to be all in one file, for instance. For another, writing I/O always appends a newline. Try writing binary files with that. There was no way to get at the bit representation of a type. Etc.

That's all gone in modern Pascal dialects. Delphi is very similar to D; it's practically a Pascal version of D. The OOP features are the same, except for some small differences, which make Delphi a bit more flexible (virtual and named constructors...).

The problem was, in the 80's, pure Pascal was useless and so needed dialects. Every Pascal vendor added a boatload of extensions, all incompatible with each other. None had enough market share to create a de-facto standard. All this left a huge opening for C, and the rest, as they say, is history. The market window closed for Pascal.

Yeah, as it was discussed in this thread. I was just posting this, because you tell so often about your bad experiences with Pascal. I context of retard's posting I also found it funny how the history of programming languages seems to repeat itself.
Jan 04 2010
prev sibling parent reply Mike James <foo bar.com> writes:
Walter Bright Wrote:

 grauzone wrote:
 Walter Bright wrote:
 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 When I then picked up K+R C, I never wrote another line of Pascal. 
 It so
 soured me on Pascal that I never got on the later bandwagons of Modula
 II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination. I fail to see Pascal as a religion. I don't know what the pure Pascal compiler you're talking about is, but ordinary Pascal is just another procedural systems programming language like C. It has a bit different syntax ("begin end" vs "{}" and so on), somewhat different rules for some default data types, but it's more or less C wrapped in a syntactic mask.

Pick up a copy of "Pascal User Manual and Report." That's pure Pascal. It's also quite useless. Your program has to be all in one file, for instance. For another, writing I/O always appends a newline. Try writing binary files with that. There was no way to get at the bit representation of a type. Etc.

That's all gone in modern Pascal dialects. Delphi is very similar to D; it's practically a Pascal version of D. The OOP features are the same, except for some small differences, which make Delphi a bit more flexible (virtual and named constructors...).

The problem was, in the 80's, pure Pascal was useless and so needed dialects. Every Pascal vendor added a boatload of extensions, all incompatible with each other. None had enough market share to create a de-facto standard.

Borland Pascal, Borland Pascal with Objects and Borland Delphi became the de-facto standard. They dropped the ball and Freepascal/Lazarus picked up the ball. Freepascal now includes templates.
 
 All this left a huge opening for C, and the rest, as they say, is 
 history. The market window closed for Pascal.

Jan 04 2010
parent bearophile <bearophileHUGS lycos.com> writes:
Mike James:

Freepascal now includes templates.<

I didn't know it. They are for classes only for now, but in future they may add for records, functions, etc, too. They are named Generics: http://www.freepascal.org/docs-html/ref/refch8.html It has operator overloading too: http://www.freepascal.org/docs-html/ref/refch12.html (And other things like built-in properties were already present). FreePascal generics are more limited than D2 templates, but FreePascal has metaclasses and RTTI that replace some template purposes. Now FreePascal looks like a quite expressive language, you can probably use it to do most of things you can do with D :-) Bye, bearophile
Jan 04 2010
prev sibling next sibling parent bearophile <bearophileHUGS lycos.com> writes:
grauzone:
 That's all gone in modern Pascal dialects. Delphi is very similar to D; 
 it's practically a Pascal version of D. The OOP features are the same, 
 except for some small differences, which make Delphi a bit more flexible 
 (virtual and named constructors...).

And as you know, C# was partially designed by the same people :-) About Delphi virtual constructors: http://www.felix-colibri.com/papers/oop_components/delphi_virtual_constructor/delphi_virtual_constructor.html About Delphi named constructors: http://stackoverflow.com/questions/1758917/delphi-pascal-overloading-a-constructor-with-a-different-prototype/1759217#1759217 In Table 2-1 shows a list of some Delphi features: http://oreilly.com/catalog/delphi/chapter/ch02.html Beside virtual methods there are dynamic methods too, that are unrelated to dynamic methods of C#:
Instead of using the virtual directive, you can also use the dynamic directive.
The semantics are identical, but the implementation is different. Looking up a
virtual method in a VMT is fast because the compiler generates an index
directly into a VMT. Looking up a dynamic method is slower. Calling a dynamic
method requires a linear search of a class's dynamic method table (DMT). If the
class does not override that method, the search continues with the DMT of the
base class. The search continues with ancestor classes until TObject is reached
or the method is found. The tradeoff is that in a few circumstances, dynamic
methods take up less memory than virtual methods. Unless you are writing a
replacement for the VCL, you should use virtual methods, not dynamic methods.
See Chapter 3 for a complete explanation of how dynamic and virtual methods are
implemented.<

There are even metaclasses (from the same document):
A class, too, is a distinct entity (as in Java, but unlike C++). Delphi's
representation of a class is a read-only table of pointers to virtual methods
and lots of information about the class. A class reference is a pointer to the
table. (Chapter 3, Runtime Type Information, describes in depth the layout of
the class tables.) The most common use for a class reference is to create
objects or to test the type of an object reference, but you can use class
references in many other situations, including passing class references as
routine parameters or returning a class reference from a function. The type of
a class reference is called a metaclass.<

In C++/D to do something similar to metaclasses you use templates: http://marcin.wudarczyk.pl/education/tipstricks/metacls.htm
 The only thing that was really lacking in Delphi are templates. But for 
 compensation, it had powerful RTTI.

About Delphi RTTI, this document is not new (it seems updated to Delphi 4, that's a bit ancient) but it looks well written: http://www.blong.com/Conferences/BorConUK98/DelphiRTTI/CB140.htm Bye, bearophile
Jan 04 2010
prev sibling parent #ponce <aliloko gmail.com> writes:
 
 That's all gone in modern Pascal dialects. Delphi is very similar to D; 
 it's practically a Pascal version of D. The OOP features are the same, 
 except for some small differences, which make Delphi a bit more flexible 
 (virtual and named constructors...).
 
 The only thing that was really lacking in Delphi are templates. But for 
 compensation, it had powerful RTTI. Try writing a 
 reflection/serialization mechanism in D that's as powerful Delphi's. I 
 bet you won't succeed, not even with D2. (Need to fix some compiler bugs 
 or deficiencies in the area of __traits first.) Even if you succeed, the 
 end result will be probably harder to use. (If that sounds polemic, show 
 me a D library that implements full serialization on 
 Delphi/Java/whatever level, and I'll shut up.)

Other interesting features of Delphi were: - incredibly fast compilation time allowed by the language, you can almost develop in release mode - properties "done right", with zero overhead (but cumbersome to write) - similar productivity and feeling that D can provide - very good low-level bit manipulation: absolute prevent all union tricks, "value" type casts are reinterpret_cast (no way to turn a float into an int silently), inline-assembly like D - "Borland fastcall", using the three registers EAX, ECX and EDX
Jan 04 2010
prev sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 
 Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination.

You don't have an idea how many times I heard the phrase "Please, please, let this work" out of a programmer's mouth in front of a computer.
Jan 04 2010
next sibling parent Mike James <foo bar.com> writes:
Ary Borenszweig Wrote:

 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 
 Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination.

You don't have an idea how many times I heard the phrase "Please, please, let this work" out of a programmer's mouth in front of a computer.

But thats not to the God of Languages, thats to the God of Demonstrations...
Jan 04 2010
prev sibling parent reply Daniel de Kok <me nowhere.nospam> writes:
On 2010-01-04 19:15:39 +0100, "Nick Sabalausky" <a a.a> said:
 Aren't there people who swear by those languages for normal software
 development purposes? And even if not, there are certainly languages out
 there that are "cram everything into this paradigm, yay purity!" and *are*
 either intended for everyday use or used by people for everyday use.

Yes, just like some people swear by 'everything is impure' languages, and go lengths to achieve immutability (e.g. Java). Why are those prefering purity called religious, and those using completely 'impure' languages practical? Pure, partially pure, impure. All regimes can be religious or practical, or both. -- Daniel
Jan 04 2010
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
retard wrote:
 Mon, 04 Jan 2010 20:04:13 +0100, Daniel de Kok wrote:
 
 On 2010-01-04 19:15:39 +0100, "Nick Sabalausky" <a a.a> said:
 Aren't there people who swear by those languages for normal software
 development purposes? And even if not, there are certainly languages
 out there that are "cram everything into this paradigm, yay purity!"
 and *are* either intended for everyday use or used by people for
 everyday use.

and go lengths to achieve immutability (e.g. Java). Why are those prefering purity called religious, and those using completely 'impure' languages practical? Pure, partially pure, impure. All regimes can be religious or practical, or both.

I think quite often the desire for practicality follows the principles of fundamentalism. I don't want to hurt anyone's feelings with this OT talk, but even as an atheist I admit that some religions are quite ok. But the fundamentalists are almost always dangerous to the persons near them. It's quite common to hear things like - "Everything must be modeled in UML 2.0" - "This development process solves all problems, even the ones introduced on the language level" - "C++ and template metaprogramming provides extreme optimal performance on this problem domain" - "Large doses of REST, AJAX, XML, and Web 2.0 cloud will so totally save this crappy project" - "100% coverage in unit tests is integral part of our process. It guarantees delivery of high quality end products" - "In clean code functions should accept only one parameter" Most of the fundamentalist technologies exist - surprise, surprise - only in the imperative mainstream programmer world.

Meh. Most of the fundamentalist technologies exist in environments that are being used and need improvement. Andrei
Jan 04 2010
prev sibling next sibling parent reply dsimcha <dsimcha yahoo.com> writes:
== Quote from Nick Sabalausky (a a.a)'s article
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I actually think Smalltalk had the better idea. Java doesn't support any paradigm besides OO well, and neither does Smalltalk. The difference is that, in Smalltalk, at least everything is an object, so you can do "pure" OO well. Java is "almost pure" OO, but it lack of ints, floats, etc. being objects, combined with its lack of support for any paradigm that works well without ints, floats, etc. being objects, makes the language feel like a massive kludge, and leads to debacles like autoboxing to get around this. In multiparadigm languages like D, C++ and C#, the lack of ints, floats, etc. being objects is less of an issue because, although it's a wart in the OO system, noone is forcing you to use the OO system for **everything**.
Jan 01 2010
parent reply "Nick Sabalausky" <a a.a> writes:
"dsimcha" <dsimcha yahoo.com> wrote in message 
news:hhlsk7$2v03$1 digitalmars.com...
 == Quote from Nick Sabalausky (a a.a)'s article
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I actually think Smalltalk had the better idea. Java doesn't support any paradigm besides OO well, and neither does Smalltalk. The difference is that, in Smalltalk, at least everything is an object, so you can do "pure" OO well. Java is "almost pure" OO, but it lack of ints, floats, etc. being objects, combined with its lack of support for any paradigm that works well without ints, floats, etc. being objects, makes the language feel like a massive kludge, and leads to debacles like autoboxing to get around this. In multiparadigm languages like D, C++ and C#, the lack of ints, floats, etc. being objects is less of an issue because, although it's a wart in the OO system, noone is forcing you to use the OO system for **everything**.

I certainly agree about Java and multiparadign languages, but I never understood how, for instance, making the "if" statement an object ever did anything but obfuscate Smalltalk and give people warm fuzzies for being uber-consistent.
Jan 01 2010
parent reply yigal chripun <yigal100 gmail.com> writes:
Nick Sabalausky Wrote:

 "dsimcha" <dsimcha yahoo.com> wrote in message 
 news:hhlsk7$2v03$1 digitalmars.com...
 == Quote from Nick Sabalausky (a a.a)'s article
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I actually think Smalltalk had the better idea. Java doesn't support any paradigm besides OO well, and neither does Smalltalk. The difference is that, in Smalltalk, at least everything is an object, so you can do "pure" OO well. Java is "almost pure" OO, but it lack of ints, floats, etc. being objects, combined with its lack of support for any paradigm that works well without ints, floats, etc. being objects, makes the language feel like a massive kludge, and leads to debacles like autoboxing to get around this. In multiparadigm languages like D, C++ and C#, the lack of ints, floats, etc. being objects is less of an issue because, although it's a wart in the OO system, noone is forcing you to use the OO system for **everything**.

I certainly agree about Java and multiparadign languages, but I never understood how, for instance, making the "if" statement an object ever did anything but obfuscate Smalltalk and give people warm fuzzies for being uber-consistent.

Have you ever actually used Smalltalk?? I have used it and it's the easiest language to use by far, having conditionals as methods of Boolean is much better, easier to read and more flexiable. The beauty of smalltalk is that you can easily add new "language" features in the library with little effort and they do not look foreign to the language. in fact, almost all of smalltalk is implemented in the library and it only has 5 actual keywords.
Jan 02 2010
parent reply Walter Bright <newshound1 digitalmars.com> writes:
yigal chripun wrote:
 Have you ever actually used Smalltalk?? I have used it and it's the
 easiest language to use by far, having conditionals as methods of
 Boolean is much better, easier to read and more flexiable.
 
 The beauty of smalltalk is that you can easily add new "language"
 features in the library with little effort and they do not look
 foreign to the language. in fact, almost all of smalltalk is
 implemented in the library and it only has 5 actual keywords.

What's your opinion, then, about why Smalltalk has failed to catch on?
Jan 02 2010
parent reply yigal chripun <yigal100 gmail.com> writes:
Walter Bright Wrote:

 yigal chripun wrote:
 Have you ever actually used Smalltalk?? I have used it and it's the
 easiest language to use by far, having conditionals as methods of
 Boolean is much better, easier to read and more flexiable.
 
 The beauty of smalltalk is that you can easily add new "language"
 features in the library with little effort and they do not look
 foreign to the language. in fact, almost all of smalltalk is
 implemented in the library and it only has 5 actual keywords.

What's your opinion, then, about why Smalltalk has failed to catch on?

That's a completely separate issue. Success of any product or idea depends on many aspects of which technical superiority is only one. I've used Smalltalk and it is most definitly superior to most other languages including D. Compare to cars - the most popular and successful design is that of the internal combustion engine yet it's the worst design in technical terms, there are more effecient and much cleaner designs. compare to OSes - Unix died in the Unix wars and was replaced by a much worse system called windows which today has over 90% market share. Windows is by far the worst OS ever and yet this is the design that won. Technically speaking Linux today is much better and I enjoyed using it but ultimatly my main system today is windows 7 and not for technical reasons. Compare to Java - a mediocre language at best yet very popular and in fact I'd prefer to use Java over D too beacuse the fact that D is a (much) better langauge is a tiny aspect of productivity of a programmer. Java has a lot of amazing tools that support it and a lot of freely available libraries while in D we still can't have only one standard lib. So while it's fun to play with D, for real stuff I'll prefer Java with eclipse and all the standardized libs that make my life that much more simple.
Jan 03 2010
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
yigal chripun wrote:
 Walter Bright Wrote:
 
 yigal chripun wrote:
 Have you ever actually used Smalltalk?? I have used it and it's the
 easiest language to use by far, having conditionals as methods of
 Boolean is much better, easier to read and more flexiable.

 The beauty of smalltalk is that you can easily add new "language"
 features in the library with little effort and they do not look
 foreign to the language. in fact, almost all of smalltalk is
 implemented in the library and it only has 5 actual keywords.

What's your opinion, then, about why Smalltalk has failed to catch on?

That's a completely separate issue. Success of any product or idea depends on many aspects of which technical superiority is only one. I've used Smalltalk and it is most definitly superior to most other languages including D. Compare to cars - the most popular and successful design is that of the internal combustion engine yet it's the worst design in technical terms, there are more effecient and much cleaner designs. compare to OSes - Unix died in the Unix wars and was replaced by a much worse system called windows which today has over 90% market share. Windows is by far the worst OS ever and yet this is the design that won. Technically speaking Linux today is much better and I enjoyed using it but ultimatly my main system today is windows 7 and not for technical reasons. Compare to Java - a mediocre language at best yet very popular and in fact I'd prefer to use Java over D too beacuse the fact that D is a (much) better langauge is a tiny aspect of productivity of a programmer. Java has a lot of amazing tools that support it and a lot of freely available libraries while in D we still can't have only one standard lib. So while it's fun to play with D, for real stuff I'll prefer Java with eclipse and all the standardized libs that make my life that much more simple.

You didn't answer the question. What's your opinion about why Smalltalk has failed to catch on? Andrei
Jan 03 2010
parent yigal chripun <yigal100 gmail.com> writes:
Andrei Alexandrescu Wrote:

 yigal chripun wrote:
 Walter Bright Wrote:
 
 yigal chripun wrote:
 Have you ever actually used Smalltalk?? I have used it and it's the
 easiest language to use by far, having conditionals as methods of
 Boolean is much better, easier to read and more flexiable.

 The beauty of smalltalk is that you can easily add new "language"
 features in the library with little effort and they do not look
 foreign to the language. in fact, almost all of smalltalk is
 implemented in the library and it only has 5 actual keywords.

What's your opinion, then, about why Smalltalk has failed to catch on?

That's a completely separate issue. Success of any product or idea depends on many aspects of which technical superiority is only one. I've used Smalltalk and it is most definitly superior to most other languages including D. Compare to cars - the most popular and successful design is that of the internal combustion engine yet it's the worst design in technical terms, there are more effecient and much cleaner designs. compare to OSes - Unix died in the Unix wars and was replaced by a much worse system called windows which today has over 90% market share. Windows is by far the worst OS ever and yet this is the design that won. Technically speaking Linux today is much better and I enjoyed using it but ultimatly my main system today is windows 7 and not for technical reasons. Compare to Java - a mediocre language at best yet very popular and in fact I'd prefer to use Java over D too beacuse the fact that D is a (much) better langauge is a tiny aspect of productivity of a programmer. Java has a lot of amazing tools that support it and a lot of freely available libraries while in D we still can't have only one standard lib. So while it's fun to play with D, for real stuff I'll prefer Java with eclipse and all the standardized libs that make my life that much more simple.

You didn't answer the question. What's your opinion about why Smalltalk has failed to catch on? Andrei

I thought I did. It's for simillar reasons as in my other examples. Java was a success because it was offered free of charge with a big supportive environment - libs, tools, documantation, etc and was promoted havily by Sun. Smalltalk OTOH was sold by a few vendors that didn't know how to promote it and build a vibrant comunity around it. Those vendors didn't supply libs for common stuff the industry uses and don't forget that one of its goals was to have an educational system for kids rather than something the industry will use. The industry rarely uses products based on its technical merits anyway - they don't and shouldn't care what language is technically "better". they care only for the bottom line. that means that Java is the best for the industry: 1) has many existing tools and libs that enhance productivity and reduced the amount of code that is neeed to be written in house. 2) there are many Java programmers so it's easy to find better qulity programmers and pay them less. 3) the write once run anywhere promise - obviously saves money. 4) Is standardized yet has many vendors - no need to invest when switching vendor. BTW, none of the above apply to D.
Jan 03 2010
prev sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
yigal chripun:
 Compare to cars - the most popular and successful design is that of the
internal combustion engine yet it's the worst design in technical terms, there
are more effecient and much cleaner designs.

Most of those alternative designs have one or more flaws, or used to have in the past. The two-stroke and four-stroke engines (diesel too) are not perfect, but they don't come from random evolution. Today building hybrid engines, etc, is better, but you need technologies like supercapacitors, good batteries, ceramic inserts, good control electronics, good high-performance steel, and so on and on, that where not available in the past.
 compare to OSes - Unix died in the Unix wars and was replaced by a much worse
system called windows which today has over 90% market share. Windows is by far
the worst OS ever and yet this is the design that won. Technically speaking
Linux today is much better and I enjoyed using it but ultimatly my main system
today is windows 7 and not for technical reasons. 

The Windows95 OS may be worse, but the GUI of XP was much more refined and usable for non-guru-level users. Things are slowly changing, as Ubuntu GUI gets a bit better, it eventually will become about as good as Windows95 GUI or better :-) Most people don't care of a better kernel if the OS interface forces you to edit small text files spread everywhere that risk breaking your system at each little error :o)
 Compare to Java - a mediocre language at best yet very popular and in fact I'd
prefer to use Java over D too beacuse the fact that D is a (much) better
langauge is a tiny aspect of productivity of a programmer.<

Compared to D Java is also much safer than D, its compiler gives better error messages, its GCs are way better, its semantics is better defined and better enforced, HotSpot is better than even LDC with LLVM and can lead to faster programs, Java as language is simpler to learn and to use, you can run it in a browser, it's simpler to add/change parts to a Java program at runtime, its reflection is better, etc. I like D more, but Java is not bad. Regarding Smalltalk, its syntax is weird for people that come from C/C++, its performance can't be compared to the current Java performance. I think that using txt source files, as in Java, is more compatible with the way many people have programmed. I don't believe in "idealistic pure" languages, as Smalltalk; multi-paradigm languages like D/C#/CLisp are better if you have to write real programs. To write normal non-performance critical applications today C# (mixed with few other things like C++) looks like the best language (and I think eventually in few more years it will become free enough to be usable on non Windows systems too). Bye, bearophile
Jan 03 2010
parent Walter Bright <newshound1 digitalmars.com> writes:
retard wrote:
 Regarding Smalltalk, its syntax is weird for people that come from
 C/C++

I claim that currently this is the main reason for people not adopting Smalltalk or any other language. Even if smalltalk was 50% faster than C+ + and 100% safer, there would be legions of morons how still want to stick with C++ or C when building end-user GUI applications. Mainstream programmers don't want to use their brain - they're happy with the C family syntax and refuse to learn any other syntax. After all, with the common syntax you can more or less easily use c,c++,c#,d,java,scala,php, and many less known languages. Most mainstream programmers also only know the parts of these languages that they all share - a nice imperative dialect which is very handy for writing ugly, buggy, and badly performing business code.

Syntax is just syntax, not semantics, and I'm not sure there's any particular reason why Smalltalk could not use curly brace syntax. If I was the Smalltalk creator, and syntax was the barrier to adopting it, I'd change the syntax. D deliberately uses the C/C++/Java style syntax because that is the most popular and well known.
Jan 03 2010
prev sibling next sibling parent retard <re tard.com.invalid> writes:
Sun, 03 Jan 2010 09:00:53 -0500, bearophile wrote:

 yigal chripun:
 The Windows95 OS may be worse, but the GUI of XP was much more refined
 and usable for non-guru-level users. Things are slowly changing, as
 Ubuntu GUI gets a bit better, it eventually will become about as good as
 Windows95 GUI or better :-)

Ha, oh really? The fact is, all major desktop environments have their usability and technical issues. Ubuntu is a rather small player in this game. For instance Apple has been selling Macs really aggressively. KDE4 is also becoming a serious alternative - Qt *is* very powerful (if not best) toolkit for building modern desktop applications. Now that many intranet and internet applications are being built on web (2.0) platform, the choice of OS shouldn't matter. But in reality many intranet apps still require IE 6 and ActiveX. Some internet apps only work in internet explorer 6 or 7 (wine + unofficial ie packs help in this, of course). No matter how good the competitive products are and how little they cost (they're free as in beer, as everyone here might know), it will take tens of years for people and industries to switch. Even if Microsoft had died some years ago and WinXP was the latest windows release for some unknown reason, probably the majority (>50% of users) would start using alternative OSes in 2030, definitely no sooner.
 Most people don't care of a better kernel if
 the OS interface forces you to edit small text files spread everywhere
 that risk breaking your system at each little error :o)

Most people are dumb as a rock. They think you need MS Office Word for writing e-mails. They know that IE6 = internet = computer = email = facebook = web = google = browser = virus = something. They buy stuff because a salesman tells them to. Usually the salesman recommends buying latest Windows, MS Office Pro, Adobe Photoshop, and other interesting stuff like the most expensive anti-virus software available when a clueless casual user asks anything.
 Compared to D Java is also much safer than D, its compiler gives better
 error messages, its GCs are way better, its semantics is better defined
 and better enforced, HotSpot is better than even LDC with LLVM and can
 lead to faster programs, Java as language is simpler to learn and to
 use, you can run it in a browser, it's simpler to add/change parts to a
 Java program at runtime, its reflection is better, etc. I like D more,
 but Java is not bad.

Don't forget aspectj and other aspect frameworks, interoperatibility with other jvm languages.
 Regarding Smalltalk, its syntax is weird for people that come from
 C/C++

I claim that currently this is the main reason for people not adopting Smalltalk or any other language. Even if smalltalk was 50% faster than C+ + and 100% safer, there would be legions of morons how still want to stick with C++ or C when building end-user GUI applications. Mainstream programmers don't want to use their brain - they're happy with the C family syntax and refuse to learn any other syntax. After all, with the common syntax you can more or less easily use c,c++,c#,d,java,scala,php, and many less known languages. Most mainstream programmers also only know the parts of these languages that they all share - a nice imperative dialect which is very handy for writing ugly, buggy, and badly performing business code.
Jan 03 2010
prev sibling next sibling parent retard <re tard.com.invalid> writes:
Sat, 02 Jan 2010 12:23:36 -0800, Walter Bright wrote:

 yigal chripun wrote:
 Have you ever actually used Smalltalk?? I have used it and it's the
 easiest language to use by far, having conditionals as methods of
 Boolean is much better, easier to read and more flexiable.
 
 The beauty of smalltalk is that you can easily add new "language"
 features in the library with little effort and they do not look foreign
 to the language. in fact, almost all of smalltalk is implemented in the
 library and it only has 5 actual keywords.

What's your opinion, then, about why Smalltalk has failed to catch on?

The same question could be asked just about any language. If you have followed the internet discussion & hype around JVM/.NET languages - these are all very young languages and share many aspects. Languages like Clojure seem to be doing well.. Why? Charismatic leaders, perhaps? "Clojure: Lisp done right" - I don't believe that, but many do. People are sheeple. They believe that languages are religions. Marketing matters. Technical superiority rarely has much effect.
Jan 03 2010
prev sibling next sibling parent retard <re tard.com.invalid> writes:
Fri, 01 Jan 2010 22:23:03 +0000, dsimcha wrote:

 == Quote from Nick Sabalausky (a a.a)'s article
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I actually think Smalltalk had the better idea. Java doesn't support any paradigm besides OO well, and neither does Smalltalk. The difference is that, in Smalltalk, at least everything is an object, so you can do "pure" OO well. Java is "almost pure" OO, but it lack of ints, floats, etc. being objects, combined with its lack of support for any paradigm that works well without ints, floats, etc. being objects, makes the language feel like a massive kludge, and leads to debacles like autoboxing to get around this. In multiparadigm languages like D, C++ and C#, the lack of ints, floats, etc. being objects is less of an issue because, although it's a wart in the OO system, noone is forcing you to use the OO system for **everything**.

In Java generics doesn't work with primitive types, in D it does. And generics often happens to be the most useful way of providing polymorphism in that context. In "pure OOP languages" all primitives are objects so normal sub-typing works. That also solves the issue, although it has an impact on performance. These are the main reasons why Java feels kludgy in this area.
Jan 03 2010
prev sibling next sibling parent retard <re tard.com.invalid> writes:
Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:

 Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

Didn't read the original article, but the one being linked to is completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

I agree, the old programming-language-as-religion problem. I first ran into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination. I fail to see Pascal as a religion. I don't know what the pure Pascal compiler you're talking about is, but ordinary Pascal is just another procedural systems programming language like C. It has a bit different syntax ("begin end" vs "{}" and so on), somewhat different rules for some default data types, but it's more or less C wrapped in a syntactic mask. Switching from Pascal to C is like swiching from Christianity to Islam. Both are strict monotheistic mainstream religions. C developed into C++. The Pascal equivalent is Object Pascal. Also those are pretty similar. TurboPascal = borland's brand for their pascal compiler - ever heard of Turbo C? From Pascal user's point of view: "I never got on the later bandwagons of Objective C, C++, Turbo C, etc. Never even looked at them." The languages are no religions per se. Some single paradigm languages are single paradigm theoretic experiments for a good reason. E.g. how else would you prove things like Curry-Howard correspondence? (Go ahead - do it in D..) Those language were not meant to be practical programming languages. It just happens to be the case that some people managed to build a real world compiler for them. But of course that's possible - the languages mostrly are Turing complete etc.
Jan 03 2010
prev sibling next sibling parent Michael Rynn <michaelrynn optusnet.com.au> writes:
On Mon, 04 Jan 2010 04:10:28 +0000, retard wrote:

 Sat, 02 Jan 2010 12:23:36 -0800, Walter Bright wrote:
 
 yigal chripun wrote:
 Have you ever actually used Smalltalk?? I have used it and it's the
 easiest language to use by far, having conditionals as methods of
 Boolean is much better, easier to read and more flexiable.
 
 The beauty of smalltalk is that you can easily add new "language"
 features in the library with little effort and they do not look
 foreign to the language. in fact, almost all of smalltalk is
 implemented in the library and it only has 5 actual keywords.

What's your opinion, then, about why Smalltalk has failed to catch on?

The same question could be asked just about any language. If you have followed the internet discussion & hype around JVM/.NET languages - these are all very young languages and share many aspects. Languages like Clojure seem to be doing well.. Why? Charismatic leaders, perhaps? "Clojure: Lisp done right" - I don't believe that, but many do. People are sheeple. They believe that languages are religions. Marketing matters. Technical superiority rarely has much effect.

I had a quick look to see what Clojure was about, and watched the video on the link on the http://clojure.org site. (Video of a talk from QCon on State and Identity). Clojure is designed as better ways to mix imperative and functional parts of programs easily "on a local system". No more messing directly with locks, which can have problems. ( which "only experts can get right initially, and then its hard to maintain"). With multi-processor cores, easily doing parallel programming is becoming the future. We cannot expect as programmers to "stop the world" as in iterative-only programming. Well it was a good sales talk. I found the complicated ways of using indirection to support different versions of object instances using shared tree node membership, interesting, and the statement that we had better get used to the idea that the version being accessed may already be outdated, and the use of time relative checks, compare and Set, immutable data, software transactional memory (STM). And Lisp syntax. But no classic OO inheritance. A lot of things needed to support concurrency, and Richard Hickey says you have to do all of clojures tricks to make it all work. The builtin collection facilities are designed with the STM support. Its for JVM or CLR. Most programs, with the exeception of multi-user databases and servers, massive climate and weather models, maybe a few concurrent threads at most. Of course we can still get by with fiddling synchronized object locks, notify and wait. Its nice if the language has support built in. I look forward to seeing results of more evolution of D to support concurrency, and what will need to change.
Jan 04 2010
prev sibling next sibling parent reply retard <re tard.com.invalid> writes:
Mon, 04 Jan 2010 07:50:12 -0200, Ary Borenszweig wrote:

 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:
 
 Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination.

You don't have an idea how many times I heard the phrase "Please, please, let this work" out of a programmer's mouth in front of a computer.

Now what does that prove? That the person has religious beliefs or that programming languages are religions? My point was, it's just stupid to claim that some languages like ML or Iswim are religions. They were originally built for scientific use, namely for proving mathematical properties of some systems and as a proof of concept. I guess lolcode isn't a religion in your book because not only is it useless, it's fun unlike most functional languages.
Jan 04 2010
parent "Nick Sabalausky" <a a.a> writes:
"retard" <re tard.com.invalid> wrote in message 
news:hhsmop$1aev$5 digitalmars.com...
 Mon, 04 Jan 2010 07:50:12 -0200, Ary Borenszweig wrote:

 retard wrote:
 Fri, 01 Jan 2010 12:19:25 -0800, Walter Bright wrote:

 Nick Sabalausky wrote:
 "Walter Bright" <newshound1 digitalmars.com> wrote in message
 news:hhgvqk$8cj$2 digitalmars.com...
 An interesting counterpoint to the usual FP hype:

 http://prog21.dadgum.com/55.html

completely in line with how I feel about not just FP, but all programming paradigms, for example, OO: It's great as long as you don't pull a Java or (worse yet) a Smalltalk and try to cram *everything* into the paradigm.

into this when I read the original Pascal book, and became enamored with it. I tried doing a modest project in Pascal using a pure Pascal compiler. 80% went smoothly, the other 20% spent wrestling with the nanny language tsk-tsking consumed nearly 100% of the time spend on the project. I just couldn't get things that had to be done, done, as the language would shut off all the avenues. When I then picked up K+R C, I never wrote another line of Pascal. It so soured me on Pascal that I never got on the later bandwagons of Modula II, Delphi, TurboPascal, etc. Never even looked at them.

The programming-language-as-religion problem exists only in your imagination.

You don't have an idea how many times I heard the phrase "Please, please, let this work" out of a programmer's mouth in front of a computer.

Now what does that prove? That the person has religious beliefs or that programming languages are religions? My point was, it's just stupid to claim that some languages like ML or Iswim are religions. They were originally built for scientific use, namely for proving mathematical properties of some systems and as a proof of concept. I guess lolcode isn't a religion in your book because not only is it useless, it's fun unlike most functional languages.

Aren't there people who swear by those languages for normal software development purposes? And even if not, there are certainly languages out there that are "cram everything into this paradigm, yay purity!" and *are* either intended for everyday use or used by people for everyday use.
Jan 04 2010
prev sibling parent retard <re tard.com.invalid> writes:
Mon, 04 Jan 2010 20:04:13 +0100, Daniel de Kok wrote:

 On 2010-01-04 19:15:39 +0100, "Nick Sabalausky" <a a.a> said:
 Aren't there people who swear by those languages for normal software
 development purposes? And even if not, there are certainly languages
 out there that are "cram everything into this paradigm, yay purity!"
 and *are* either intended for everyday use or used by people for
 everyday use.

Yes, just like some people swear by 'everything is impure' languages, and go lengths to achieve immutability (e.g. Java). Why are those prefering purity called religious, and those using completely 'impure' languages practical? Pure, partially pure, impure. All regimes can be religious or practical, or both.

I think quite often the desire for practicality follows the principles of fundamentalism. I don't want to hurt anyone's feelings with this OT talk, but even as an atheist I admit that some religions are quite ok. But the fundamentalists are almost always dangerous to the persons near them. It's quite common to hear things like - "Everything must be modeled in UML 2.0" - "This development process solves all problems, even the ones introduced on the language level" - "C++ and template metaprogramming provides extreme optimal performance on this problem domain" - "Large doses of REST, AJAX, XML, and Web 2.0 cloud will so totally save this crappy project" - "100% coverage in unit tests is integral part of our process. It guarantees delivery of high quality end products" - "In clean code functions should accept only one parameter" Most of the fundamentalist technologies exist - surprise, surprise - only in the imperative mainstream programmer world. That world is so full of all kinds of pseudo-science that it often makes me vomit. But it's often nicer than unemployment..
Jan 04 2010