I have try to find out myself and checked some Scheme and Lisp pages. But althought I'm sure this question was asked a hundred times before, I wasn't able to figure it out.
It's about Scheme and Common Lisp. Does it make sense to learn one or the other, or both, or just one of it?
My background: I'm an Eiffel-Programmer, and I think I know quite a bit about C/C++ and I refuse to do programming a line of C++. So Common Lisp seems to me a bit like C++. Is that a correct impression? Someone compared Scheme Standard to CL standard and this was quite frightning. Scheme comes along with around 50 pages CL with 1100 pages. So does that means Scheme (lean and mean) CL (big and complex) but more powerful?
On other pages I read the CL is very good for prototyping and it seems possible to add some type-checking to CL Functions. But I don't have to. So maybe I could use CL for scritping as for larger scale programming.
I have downloaded diverse Common Lisp systems and I have the Scheme Shell. And of course I would like to to scripting in one of the two languages. Does it make sense to use CL for such an area or is Scheme a better choice here?
I have started with doing some scsh-programming. And even thought I had a hard time, the elegance of Scheme begins to shine IMO. And I have three books around which uses Scheme so I have to admit I'm starting to like it more and more. But a look onto CL gave let me start thinking again. CL seems to have far more support for OO-programming and Eiffel is an OO-languae so I migth like CL more.
It would be nice if some of you gave me your thoughts about that.
Friedrich Dominicus <Friedrich.Domini...@inka.de> writes: > I have try to find out myself and checked some Scheme and Lisp pages. > But althought I'm sure this question was asked a hundred times before, I > wasn't able to figure it out.
> It's about Scheme and Common Lisp. Does it make sense to learn one or > the other, or both, or just one of it?
The two languages are quite different in terms of how they are used, what programming styles they promote, what community of users they attract, the capabilities they offer, and the overall language focus.
You ask an extraordinarily subjective question, but you offer enough about yourself to answer in a way that is probably best for you. Please do not repeat this answer to anyone else; send them instead back to this group and let them get their own answer based on their own needs.
> ... the elegance of Scheme begins to shine ...
If elegance is what you seek in a language, my take is that you're likely better off with Scheme. That's not because Scheme is a better (or worse) language. It's because it was mostly designed by and for people who, when faced with a decision between a choice of doing something "a practical way" or "an elegant way", chose the elegant way. CL is more concerned with practicality than elegance in the case where the two compete. Often CL is elegant anyway, but sometimes it is not. Often Scheme is practical anyway, but sometimes it is not. free of any commercial constraint as a programming language can be. We all want elegant, and we all want practical. But sometimes push comes to shove and we have to decide between them. The difference between the two languages shows itself ways that stem from the resolution of conflicts. Languages are like political parties; you should choose the one that is maintained by people who think like you do and care about the things you care about. It sounds, based on your brief summary like that would be the Scheme crowd.
Of course, my opinion is just that of one person. Others might view the situation differently. Good luck making your choice.
If in the end you're note sure, I'm sure you won't be harmed by learning both. But please don't hold them to the same standards. Languages should be judged by what they seek to do, not by their sameness to each other.
* Friedrich Dominicus <Friedrich.Domini...@inka.de> | It's about Scheme and Common Lisp. Does it make sense to learn one or | the other, or both, or just one of it?
if you learn Scheme, you need to learn both. if you learn Common Lisp, you don't need to learn Scheme.
| My background: I'm an Eiffel-Programmer, and I think I know quite a bit | about C/C++ and I refuse to do programming a line of C++. So Common Lisp | seems to me a bit like C++. Is that a correct impression?
no. Common Lisp is not a bit like C++.
| Someone compared Scheme Standard to CL standard and this was quite | frightning.
this "fear" might mean that Merriam-Webster's Third New International Dictionary of the English Language are frightening to a kid and that a 1000-phrase book for tourists is the best solution to teaching kids to write? I have personally looked at huge reference tomes with a sort of "wow! somebody did all that work and organized it for me!" attitude. I also consider it frightening that anyone would sit down and actually attempt to design a language and yet leave so much work to its users as Scheme does. the consequence is that Scheme is a much bigger language than Common Lisp in practice: Scheme is not a language you can use out of the box, so you have to know at least a few implementations and each has a million functions, all non-standard and slightly different in most ways. in Scheme, purity rules, so every time someone sees what he considers to be impure, he goes off to write his own, creating yet more incompatible Scheme implementations and yet more unreadable Scheme code. irony has never been quite so strong as in the "lean and mean design" of Scheme. Common Lisp has a "just do it" quality to it that I like a lot, especially since it's much, much harder to get a large language beautiful than to make a small language beautiful, and Common Lisp is beautiful.
| Scheme comes along with around 50 pages CL with 1100 pages. So does that | means Scheme (lean and mean) CL (big and complex) but more powerful?
it means Scheme was designed to prove something and Common Lisp was designed to build something.
scripting has to fit into a much large scheme of things (pun intended), and Scheme is easier to force into other schemes of things because it doesn't carry enough weight of its own to be a burden to anyone: in other words, if used for scripting, Scheme is a thin veneer of syntax on top of a different system's semantics. for some, this seems to be sufficient.
| CL seems to have far more support for OO-programming and Eiffel is an | OO-languae so I might like CL more.
I think you should approach new languages as "a programmer", not "an Eiffel programmer".
#:Erik -- suppose we blasted all politicians into space. would the SETI project find even one of them?
Friedrich Dominicus <Friedrich.Domini...@inka.de> writes: > I have try to find out myself and checked some Scheme and Lisp pages. > But althought I'm sure this question was asked a hundred times before, I > wasn't able to figure it out.
> It's about Scheme and Common Lisp. Does it make sense to learn one or > the other, or both, or just one of it?
I'd go with CL. Scheme is nice, but it lack a "wide" standard.
> My background: I'm an Eiffel-Programmer, and I think I know quite a bit > about C/C++ and I refuse to do programming a line of C++. So Common Lisp > seems to me a bit like C++. Is that a correct impression?
Get away from here! :)
> Someone > compared Scheme Standard to CL standard and this was quite > frightning.
If you refer to the 903 pages of the latest Stroustroup's book on C++ you are right. Anyway, the "standards" for CL and Scheme are rather different in content. Let's consider multi-dimensional arrays. They account for a big chunk of the CL standard. The account for 0 pages of the Scheme standard R5RS. That is because multi-dimensional arrays are not in the standard. Let's talk about records (structures). They account for another big chunk of the CL standard and they account for 0 pages of the R5RS of Scheme: once again they are not in the standard. I can go on and on and on... I feel like the pink rabbit. :)
So, comparing the CL standard to R5RS (the Scheme standard) is unfair to both. They do not cover the same material.
> Scheme comes along with around 50 pages CL with 1100 pages. So does that > means Scheme (lean and mean) CL (big and complex) but more powerful?
Not it does not. It means that your CL program will be more easily portable across different implementations. E.g. suppose you use CL and write
and then go ahead and write your program using this definition. Now you are sure that this program will run in other CL implementations as well.
Suppose, thet, by chance you write the same (non standard) program in the Scheme implementation X which does support DEFSTRUCT and then try to run it in another Scheme implementation Y, which does not. You have - at the very least - make sure that you can have the correct DEFSTRUCT library installed in implementation Y. Which of course means that, since implementation Y already supports DEFINE-RECORD, that your footprint starts to blow up. You get the idea.
> On other pages I read the CL is very good for prototyping and it seems > possible to add some type-checking to CL Functions. But I don't have to. > So maybe I could use CL for scritping as for larger scale > programming.
The term "scripting" has always eluded me :)
> I have downloaded diverse Common Lisp systems and I have the Scheme > Shell. And of course I would like to to scripting in one of the two > languages. Does it make sense to use CL for such an area or is Scheme a > better choice here?
> I have started with doing some scsh-programming. And even thought I had > a hard time, the elegance of Scheme begins to shine IMO. And I have > three books around which uses Scheme so I have to admit I'm starting to > like it more and more. But a look onto CL gave let me start thinking > again. CL seems to have far more support for OO-programming and Eiffel > is an OO-languae so I migth like CL more.
AFAIK CL has the same support for OO as Eiffel and then some. If some feature is missing, you can build it in CL (alright, let's not talk too much about type-checking - we can always invite the ML crowd for this). If some CL feature is missing in Eiffel you cannot (that is as much as I know of Eiffel). :)
Some CL compilers also do a decent job at "non lethal" :) type checking.
Hope it helps
Cheers
-- Marco Antoniotti =========================================== PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26 http://www.parades.rm.cnr.it/~marcoxa
Kent M Pitman wrote: > resolution of conflicts. Languages are like political parties; you > should choose the one that is maintained by people who think like > you do and care about the things you care about. It sounds, based on > your brief summary like that would be the Scheme crowd.
But the OO thing pushes him to che CL side so..
But now that one can do FUN, instead of #'FUN, (lambda ..) instead of #'(lambda ..)
((lambda ..) ..) instead of (funcall (lambda ..) ..)
what's left are warts like (funcall fun ..) and naming inconsistencies [no real prob with the latter, just define nullp (or null?, pair? (or cons?)), etc]
Saying (CAR NIL) (CDR NIL) are wrong is just a game of words, and whether Lisp or Scheme is right about #f is one of the great mysteries of the universe..
If you read "The Little Schemer", only in a couple of occassions does the ugliness show.
The package system is constantly under attack, and while some Schemes have nice module systems (eg: MzScheme), there's no standard.
You can write beautiful code in CL. Maybe it not "perfect", but it's not so far from that.Scheme is small, so you can get all of it quick. Get your basic lisp style up and running. Then look at CL. You can learn things you never dreamed of while doing Smalltalk, Eiffel, etc. (maybe tinyclos would do too, but I'm not sure. Certainly tinyclos is nicer, but it's the son of CLOS, after all). You'll find several books on CLOS. Will you find _any_ for the Scheme object systems (practically all of which cannot even touch CLOS?).
BTW, don't let _anybody_ talk you into believing that CL is to Scheme as C++ is to C, that's plainly an extremely innacurate and dangerous analogy.
Welcome to schizofrenia ;-)
[PS: I have an Eiffel background, am charmed by Scheme's and purely functional languages, but I'm happy with CL (sometimes I'll wonder "what's next" but I'll look more to FP than to Scheme). It's easy to think about Scheme being `dirty' then, too. I really hate bad stuff, including C++, and sometimes I surprise myself when I do some design using templates that is `cool', or by liking some well written software like ACE, that makes things `neat' (it's a dellusion, bu we all know that ;->). So maybe you can take CL. That's your call.]
Friedrich Dominicus <Friedrich.Domini...@inka.de> writes: > It's about Scheme and Common Lisp. Does it make sense to learn one or > the other, or both, or just one of it?
> My background: I'm an Eiffel-Programmer, and I think I know quite a bit > about C/C++ and I refuse to do programming a line of C++. So Common Lisp > seems to me a bit like C++. Is that a correct impression? Someone
As others have pointed out, C++ and CL aren't similar at all, neither in complexity (C++ is much more complex than CL!) nor in the reasons for the sizes of their standards. C++ is a very complex language in itself, even without any library. CL OTOH is quite a simple language at it's core (similar in simplicity to Scheme), but it includes a large library (which isn't complex in itself either). And the CL standard is rather more readable and helpful (even to non-language-lawyers) than the C++ standard.
> compared Scheme Standard to CL standard and this was quite frightning. > Scheme comes along with around 50 pages CL with 1100 pages. So does that > means Scheme (lean and mean) CL (big and complex) but more powerful?
Since you are an Eiffel programmer, I'd ask you whether you found Eiffel's "one way to loop has to be enough for everyone" approach lean, mean _and_ _practical_? If you did, I'd say you might be happy with Scheme, which isn't quite as restricted as the "RISC" language called Eiffel, and since R5RS has macros, you can at least built yourself new loops if you so desire. Of course all those loops will be non-standard, so they will be difficult to read for others.
I OTOH found the "one loop fits all" attitude extremely non-practical (in effect, Eiffel was the first ever language I used, where I really needed it's ability to automatically check variants and invariants in loops, since I regularly made mistakes in writing those loops. I normally make mistakes of that sort in other languages about once in every 5 years or so).
In effect I'd be careful to distinguish between unnecessary complexity (which should be elided, but which makes up large part of C++, where the complexity seems necessary, but only because of underlying design decisions which are ill matched to it's current uses), and necessary complexity or size, which should be welcomed, since they make your life as a programmer easier, IMHO.
> three books around which uses Scheme so I have to admit I'm starting to > like it more and more. But a look onto CL gave let me start thinking > again. CL seems to have far more support for OO-programming and Eiffel > is an OO-languae so I migth like CL more.
Well, there are 100 OO subsystems for Scheme (no, wait a minute, now there are 101, no 102 ;), so you can certainly do OO programming in Scheme. Not portably though.
Also, CL doesn't make so much of it's object-orientedness than mainstream languages like Eiffel, C++, etc. do. The pure OO part of CL (i.e. CLOS) isn't fundamental to CL. The basic idea of OO (which most often get's lost in mainstream languages, i.e. that OO isn't about classes or methods, anymore than astronomy is about optical telescopes) OTOH is central to Lisp (in both CL and Scheme's guises).
Try to stop thinking in mainstream terms, it will help you avoid confusion...
Regs, Pierre.
-- Pierre Mai <p...@acm.org> PGP and GPG keys at your nearest Keyserver "One smaller motivation which, in part, stems from altruism is Microsoft- bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
> * Friedrich Dominicus <Friedrich.Domini...@inka.de> > | It's about Scheme and Common Lisp. Does it make sense to learn one or > | the other, or both, or just one of it?
> if you learn Scheme, you need to learn both. if you learn Common Lisp, > you don't need to learn Scheme.
That't a clear opinion, thanks.
> | My background: I'm an Eiffel-Programmer, and I think I know quite a bit > | about C/C++ and I refuse to do programming a line of C++. So Common Lisp > | seems to me a bit like C++. Is that a correct impression?
> no. Common Lisp is not a bit like C++.
Maybe stated to lazy. I should know better. Let's state it another way. I thinkI can like C but I can't like the OO-stuff above it in C++. So is Scheme more like C and CL in this sense more than C++?
> | Someone compared Scheme Standard to CL standard and this was quite > | frightning.
> this "fear" might mean that Merriam-Webster's Third New International > Dictionary of the English Language are frightening to a kid and that a > 1000-phrase book for tourists is the best solution to teaching kids to > write?
you mean possibly not ;-)
> I have personally looked at huge reference tomes with a sort of > "wow! somebody did all that work and organized it for me!" attitude.
Oh I guess that's a good way.
>I > also consider it frightening that anyone would sit down and actually > attempt to design a language and yet leave so much work to its users as > Scheme does. the consequence is that Scheme is a much bigger language > than Common Lisp in practice: Scheme is not a language you can use out of > the box, so you have to know at least a few implementations and each has > a million functions, all non-standard and slightly different in most > ways. in Scheme, purity rules, so every time someone sees what he > considers to be impure, he goes off to write his own, creating yet more > incompatible Scheme implementations and yet more unreadable Scheme code. > irony has never been quite so strong as in the "lean and mean design" of > Scheme. Common Lisp has a "just do it" quality to it that I like a lot, > especially since it's much, much harder to get a large language beautiful > than to make a small language beautiful, and Common Lisp is beautiful.
In short Scheme conform to their standard but extend far beyond for doing real progamming but CL is good enough to have it all standardized? I bet this is harsh simpliefied but that's what I read out of the above.
> | Scheme comes along with around 50 pages CL with 1100 pages. So does that > | means Scheme (lean and mean) CL (big and complex) but more powerful?
> it means Scheme was designed to prove something and Common Lisp was > designed to build something.
Oh I think I want to build some things ;-)
> | CL seems to have far more support for OO-programming and Eiffel is an > | OO-languae so I might like CL more.
> I think you should approach new languages as "a programmer", not "an > Eiffel programmer".
Sorry I can't be just a programmer. I come form a context and this context means that I'm very used to do Eiffel programming but I started with some imperative languages. So I'm completly biased but possibly I'm able to see advantages of FP even if I don't know much about it. I guess if you have to learn a new language which is Lisp-like you will have your bias too.
But nevertheless thanks for taking the time to answer.
> Friedrich Dominicus <Friedrich.Domini...@inka.de> writes:
> > I have try to find out myself and checked some Scheme and Lisp pages. > > But althought I'm sure this question was asked a hundred times before, I > > wasn't able to figure it out.
> > It's about Scheme and Common Lisp. Does it make sense to learn one or > > the other, or both, or just one of it?
> I'd go with CL. Scheme is nice, but it lack a "wide" standard.
> > My background: I'm an Eiffel-Programmer, and I think I know quite a bit > > about C/C++ and I refuse to do programming a line of C++. So Common Lisp > > seems to me a bit like C++. Is that a correct impression?
> Get away from here! :)
Oh now I like this group very much, don't though me out please;-) Sorry it was lazy formulated. It was in the sense C (small and relative consequent) and C++ a nighmare because of complexity added by all the virtual stuff ;-)
> > Someone > > compared Scheme Standard to CL standard and this was quite > > frightning.
> If you refer to the 903 pages of the latest Stroustroup's book on C++ > you are right. Anyway, the "standards" for CL and Scheme are rather > different in content. Let's consider multi-dimensional arrays. They > account for a big chunk of the CL standard. The account for 0 pages of > the Scheme standard R5RS. That is because multi-dimensional arrays > are not in the standard. Let's talk about records (structures). They > account for another big chunk of the CL standard and they account for > 0 pages of the R5RS of Scheme: once again they are not in the > standard. I can go on and on and on... I feel like the pink rabbit. :)
just curious what is a this pink rabbit? But thanks for pointing out why things are like they are. I dared to download the CL Hyperspec stuff and I bet some looks into it may show if it's organized that it's really helpful. I bet it is, others have stated that they found it the one of the best documents around.
> and then go ahead and write your program using this definition. Now > you are sure that this program will run in other CL implementations as > well.
> Suppose, thet, by chance you write the same (non standard) program in > the Scheme implementation X which does support DEFSTRUCT and then try > to run it in another Scheme implementation Y, which does not. You > have - at the very least - make sure that you can have the correct > DEFSTRUCT library installed in implementation Y. Which of course > means that, since implementation Y already supports DEFINE-RECORD, > that your footprint starts to blow up. You get the idea.
Thanks I didn't know that. I've downloaded the Scheme Schell and DrScheme both seem to be quite good for learning.
> > On other pages I read the CL is very good for prototyping and it seems > > possible to add some type-checking to CL Functions. But I don't have to. > > So maybe I could use CL for scritping as for larger scale > > programming.
> The term "scripting" has always eluded me :)
Why that what is negative with it. IMO it's quite positive to have a language which scales nicely. I can't tell this from Eiffel.
> Hope it helps
Yes thanks for taking the time to answer. It seems the tendency in this group is in learning CL what is not a suprise because we are in c.l.l ;-)
> Friedrich Dominicus <Friedrich.Domini...@inka.de> writes:
> > It's about Scheme and Common Lisp. Does it make sense to learn one or > > the other, or both, or just one of it?
> > My background: I'm an Eiffel-Programmer, and I think I know quite a bit > > about C/C++ and I refuse to do programming a line of C++. So Common Lisp > > seems to me a bit like C++. Is that a correct impression? Someone
> As others have pointed out, C++ and CL aren't similar at all, neither > in complexity (C++ is much more complex than CL!) nor in the reasons > for the sizes of their standards. C++ is a very complex language in > itself, even without any library. CL OTOH is quite a simple language > at it's core (similar in simplicity to Scheme), but it includes a large > library (which isn't complex in itself either). And the CL standard is > rather more readable and helpful (even to non-language-lawyers) than > the C++ standard.
This was pointed out in other replies. So I guess this fear is not all so worse.
> Since you are an Eiffel programmer, I'd ask you whether you found > Eiffel's "one way to loop has to be enough for everyone" approach > lean, mean _and_ _practical_? If you did, I'd say you might be happy > with Scheme, which isn't quite as restricted as the "RISC" language > called Eiffel, and since R5RS has macros, you can at least built > yourself new loops if you so desire. Of course all those loops will > be non-standard, so they will be difficult to read for others.
I'm quite a fan of Eiffel especiall it's idea of Design-by-Contract but I like to the static type-checking and yes I don't have any problems with the one loop. But because I think I've done quite a bit OO-programming I may be better of with CL.
> In effect I'd be careful to distinguish between unnecessary complexity > (which should be elided, but which makes up large part of C++, where > the complexity seems necessary, but only because of underlying design > decisions which are ill matched to it's current uses), and necessary > complexity or size, which should be welcomed, since they make your > life as a programmer easier, IMHO.
> > three books around which uses Scheme so I have to admit I'm starting to > > like it more and more. But a look onto CL gave let me start thinking > > again. CL seems to have far more support for OO-programming and Eiffel > > is an OO-languae so I migth like CL more.
> Well, there are 100 OO subsystems for Scheme (no, wait a minute, now > there are 101, no 102 ;), so you can certainly do OO programming in > Scheme. Not portably though.
How often do you change you Common Lisp programming environment?
> Try to stop thinking in mainstream terms, it will help you avoid > confusion...
I do think that I'm not thinking in mainstream terms. I like the if things are done consequently and in this aspect I like Eiffel very much. But I like too C and Python and as told before Scheme-solutions look quite interesting.
But what I like most about Eiffel is it's idear of Design-by-Contract. Wouldn't that s.th. what would be nice vor CL too?
In article <379EF170.33CB5...@inka.de>, Friedrich.Domini...@inka.de says...
> So is Scheme more like C and CL in this sense more than C++?
No. It's more like this: Common Lisp is to Scheme as C is to Pascal. They're different languages with different histories & cultures.
Another perspective looks like this: CL is to Smalltalk as Smalltalk is to C. Now substitute C++ for C (or Pascal for C) and Scheme for CL. That's how I'd begin to explain it to someone totally unfamiliar with CL and Scheme. As we zoom in closer, some details emerge. At some point you have a clear enough picture for you to make a choice.
I would put it another way for someone familiar with other tools. As you know Eiffel, I might substitute Eiffel for C. The problem with all of this is that it's like saying an elephant is a bit like a hippo. While it helps give a vague feeling for what these animals are like, it doesn't help you choose an animal for a zoo.
So, unless you're satisfied with some simple advise ("learn Common Lisp") you're probably going to have to do a lot of reading. I learned CL long before I even heard of Scheme, so I may be heavily biased. OTOH, that might be a significant point. You decide. -- Please note: my email address is munged; You can never browse enough "There are no limits." -- ad copy for Hellraiser
Friedrich Dominicus wrote: > Thanks I didn't know that. I've downloaded the Scheme Schell and > DrScheme both seem to be quite good for learning.
DrScheme is probably the best environment to learn Lisp. After all, that's its purpose!
> > The term "scripting" has always eluded me :) > Why that what is negative with it. IMO it's quite positive to have a > language which scales nicely. I can't tell this from Eiffel.
Because Unix-minded people need `scripts' and `real programs'. Lisp `scripts' are just real programs.
Friedrich Dominicus wrote: > Maybe stated to lazy. I should know better. Let's state it another way. > I thinkI can like C but I can't like the OO-stuff above it in C++. So > is Scheme more like C and CL in this sense more than C++?
Then you are OK. C is a portable assembler, which makes sense; while C++ is an extension of that with even more emphasis as a solution for the development of applications.
No matter the base differences between Scheme and CL, nothing comes into play when you go into the OO arena. You might not like the `lack' of encapsulation in CLOS, but there's a different mechanism for that in CL (packages). If you want classic OO encapsulation, you might find that in some classic OO system for scheme, but then, classic OO is wrong. That's the main conclusion you should come to, if you take Dylan, Cecil, or CLOS. That's one of the main interests of your journey:
Friedrich Dominicus <Friedrich.Domini...@inka.de> writes: > > Well, there are 100 OO subsystems for Scheme (no, wait a minute, now > > there are 101, no 102 ;), so you can certainly do OO programming in > > Scheme. Not portably though.
> How often do you change you Common Lisp programming environment?
The point is that if you change from CMUCL to Harlequin LW (or whatever), you know that your system will work with a far greater probability than when switching from one Scheme environment to the other.
> > Try to stop thinking in mainstream terms, it will help you avoid > > confusion...
> I do think that I'm not thinking in mainstream terms. I like the if > things are done consequently and in this aspect I like Eiffel very much. > But I like too C and Python and as told before Scheme-solutions look > quite interesting.
> But what I like most about Eiffel is it's idear of Design-by-Contract. > Wouldn't that s.th. what would be nice vor CL too?
What exactly is "Design by Contract"?
Cheers
-- Marco Antoniotti =========================================== PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY tel. +39 - 06 68 10 03 17, fax. +39 - 06 68 80 79 26 http://www.parades.rm.cnr.it/~marcoxa
Marco Antoniotti <marc...@copernico.parades.rm.cnr.it> writes: > What exactly is "Design by Contract"?
The DbC school of system design makes heavy use of pre-conditions, post-conditions, invariants and so on.
When using a DbC system, all these are given to the system in a way that it can understand and check. Check on compile-time if possible, on run-time if not.
An Eiffel person might give more detail but these are the essentials.
Stig Hemmer wrote: > [Eiffel] > Marco Antoniotti <marc...@copernico.parades.rm.cnr.it> writes: > > What exactly is "Design by Contract"?
> The DbC school of system design makes heavy use of pre-conditions, > post-conditions, invariants and so on.
> When using a DbC system, all these are given to the system in a way > that it can understand and check. Check on compile-time if possible, > on run-time if not.
> An Eiffel person might give more detail but these are the essentials.
Then she would have to learn the MOP and implement a new method combination (a macro layer :before, :after, :around methods should work, but if you're also using those..)
Replying not specifically to you, Fernando, but to some specific things you said that triggered me to want to add some general points in this discussion. Your words included, semi-out-of-context, to help understand what triggered these thoughts.
> But now that one can do FUN, instead of #'FUN, > (lambda ..) instead of #'(lambda ..)
> ((lambda ..) ..) instead of (funcall (lambda ..) ..)
> what's left are warts like (funcall fun ..) and naming inconsistencies > [no real prob with the latter, just define nullp (or null?, pair? > (or cons?)), etc]
I will continue to defend FUNCALL as a non-wart. I think it's the other way around. At the very minimuym, you should understand that there is an equally strong aesthetic theory by which (F X) to call a variable F is UNaesthetic. The Scheme community, in keeping with their one-namespace view, also often have a one-aesthetic chauvinism as well. The issue that divides us is less the technical decision for "a single namespace" and more the political decision for "single decisions". My favorite quote in this area is from an unknown source which I would happily and gratefully identify if I could: "There are two kinds of people in the world: people who think there are two kinds of people in the world and people who do not."
I also think a lack of political inclusivity is a wart. We know very little about the human brain, probably, compared to what we might know. But among those things we know is that it is capable of accomodating a huge amount of what the Scheme community would call "unaesthetic" complexity. That is, the kinds of natural languages people devise are full of special case and we have special brain hardware that make our use of that quite efficient. To build languages that do not take good advantage of our ability to do this is to waste our personal processor power. All the claims that are made about what languages are learnable or not are unscientific anecdotes based on claims of how hard it was for teachers who had a bias toward certain presentations or who had prsentations differing in huge ways (not just namespace) retrospectively and unscientifically gauging reasons and surely boiling them down to reasons that due not satisfy any definition of science I know. My experience is that CL is easy to teach to anyone who has not been fed propaganda from other languages about how languages "should be" and who does not balk merely because he/she has been trained to balk. Just as the whle LISP family is easy to teach to anyone who has not been trained to balk at non-infix. The degree to which the aesthetics by which Lisp is often externally judged is born with you is questionable at best. People do have a born-in aesthetics, but I think they often unlearn their intuitions about it when faced by a lack of ability to articulate it and a pushy person who purports (sometimes without foundation) who alleges to be able to articulate what they think better than they themselves can do. People LEARN to be bothered by two namespaces because they are TAUGHT to think namespaces don't matter. But namespaces are ROUTINELY used in natural language, and people accomodate them very well. Almost no word in any naturally arising human language has only a single definition, and yet people do not rise in revolt at this "lack of elegance". They resolve by context. If you want to do SCIENCE about what is and is not "natural", the data awaits and it does not come from languages that are made and taught by their makers to captive audiences over a five to twenty year span.
Human-derived attempts to make unambiguous languages have gone nowhere. English, which is full of contextual nuance and blunt construction, has won over the regularities of Latin and Greek and the pseudo-regularities of languages like Spanish and German partly, at least, because people don't have patience with aesthetics when they stand in the way of practicality. They want to ELECT practicality when it suits their need, but they don't want to be REQUIRED practicality.
> You can write beautiful code in CL. Maybe it not "perfect", but it's not so > far from that. Scheme is small, so you can get all of it quick.
Short languages make long programs, I claim. Long languages make short programs. The more pre-defined stuff you can draw on, and the richer the available set of words in a given context, the fewer words you must say to get across your meaning. Langauges that syntactically isolate you from the space of things you would say at a given moment in a given program make either the program bigger (as you say more baroque things or as you rewrite your program to avoid saying baroque things). In CL, if you have written
(defun foo (list) ... <cursor>
and you want to now access the LIST function, you can do it with only local editing. You can ALSO access the LIST function with only local editing.
In Scheme, the decision to bind the variable LIST is a [premature] decision not to use the variable LIST in the program you are writing. To access the outer variable requires rewriting the program. This is usually "compensated" for by not ever using the obvious names in programs, preferring variables like "LST". This makes programs inelegant, too [that is, by someone elses's (my) metric, metrics of elegance not being uniquely determined], because it doublles the size of the local set of terms, having in effect to always choose different names for globally defined names than local ones.
CL allows the decision about which LIST to access to be locally administered, and the "price" (to some) or "feature" (to others) of this is that the kind of use is case-marked. (FUNCALL f x) identifies the UNUSUAL (in CL) and less syntactically optimized case of calling a variable in ordder to allow (f x) to mean a call to the thing familiarly known as F without fear that F has been locally bound.
This is a simple trade-off. Scheme assumes you will be passing so many functions that you will have at least an equi-likely chance of wanting to call a variable named F as a globally defined function named F, and so it assumes you want to optimize this case. Most CL programmers I know would gag if functional args were passed around with enough frequency to justify optimizing this case. Likewise, as arguments, it's not common to pass the contents of globally defined function names in CL, so the case of passing one is pessimized slightly in order to make it clear that (f x) is passing a local name [you don't have to look to be sure if the binding list is on a previous screen. you always know x means "some local x" and that the user would use #'x to denote a global function by this name.
BOTH languages are doing Statistics and Politics, though, not science. That's not bad--it's what's called for; but it is not fair to say that we have made a "political outcome" and Scheme has made a "scientific outcome". A maxim I've made up for myself on this is the following: "There are no political answers, only political questions." (Something I just this moment thought of: It follows from strong typing that this must be true, right? Both arms of the IF have to have the same return type.) Both languages are probably doing right by their user base. Each one is aesthetic within the context of what it is trying to promote. Each one is political in that it has an agenda of a programming style that it thinks is useful. Loosely, and I'm exaggerating slightly for visual effect, so please don't be a stickler here: Scheme: tolerate, but don't prefer, non-functions. Lisp: tolerate, but don't prefer, functions. But what really burns me is the oft-made claim by the Scheme community that their statistical trade-off makes so much sense that it can be referred to without adverbial qualification as "aesthetic" as if there were no other kind of aesthetic worth mentioning.
I don't think Scheme is more aesthetic than Lisp, but I always send people who want "aesthetics" toward the Scheme community because I think that Scheme is a magnate for people who think that the word "aesthetic" as an unqualified term and because I just tire of talking to people with that kind of intolerant attitude. I suppose that makes me intolerant. One never get anything for free--the cost of being around tolerant folks is to be intolerant. Hmm.
Friedrich Dominicus wrote: > But what I like most about Eiffel is it's idear of Design-by-Contract. > Wouldn't that s.th. what would be nice vor CL too?
Let me give an example. The all so well known factorial. Written in an imperative style to show some extra assertions factorial(n: INTEGER): INTEGER is require n_positiv: n >= 0 local i : INTEGER do Result :=1 -- holds for n = 0 from i:= n invariant i_positive_and_less_than_n: i >=0 and then i <= n; variant i_decreases: i until i <=1 loop Result := Result * i; i := i-1 end; -- from
end; -- faculty
The interesting points are require. In which I state clearly what I expect n to be a positive number. And because loops will be problematic you have the invariant part. Which must hold fo every iteration and the variant part which must be a decreasing number but always positive. Now you may say that isn't a big thing. But if you have an ancestor and some descendants the assertions are inherited too.
This assertions can be extracted from the source and give a nice specification. And indeed you can use Eiffel for specifyin your problem.
I guess the conditions look familar to LISPERS because you are used to do declarative programming. That is what they are, they don't state how s.th is done but what has to hold. But this is quite what FP-programming is about I guess.
If that assertions does not hold an exception is risen, which you can handle in a rescue part.
* Friedrich Dominicus <Friedrich.Domini...@inka.de> | first answer: Learn both. Scheme will let you more easily graps the | "spirit" of Lisp-Programming;-)
this reminds me of something. Scheme people will go out of their way to claim that Scheme is a Lisp. this is like communist dictatorships which refer to themselves as "democracies" and people who kill doctors and bomb medical clinics and call themselves "pro-life", as if hijacking a nice word can make up for the facts. I just wish Scheme people could be proud of what they have instead of being so childish and immature that they can only enjoy their little scheming games if they can usurp somebody else's terminology.
but, hey, my first objection to GUILE was that it was a name I'd expect from politicians too self-loathing to be proud of what they did, and Schemer and Conniver have similar connotations with me¹, strengthened after looking at what Scheme people do when you say that Scheme should be good enough on its own not to need the Lisp label so it can blame Common Lisp for everything when it fails. you see, "Scheme" is what they call their language when they succeed. when they fail, they call it "Lisp". for as long as I have been watching Scheme people, they have contributed much more to the bad name that "Lisp" has than to the good name that they think "Scheme" has by unloading all their misery on the "Lisp" name. so look out for people who object to Common Lisp because they once got burned on a Scheme project, or learned Scheme from a bad teacher who insisted that Scheme is the only true Lisp. scheming bastards, indeed.
(this article contains 240% of the RDA of cynicism. please limit your intake if you feel irritated. prolonged exposure may also cause anger.)
#:Erik ------- ¹ like FORTH was called just that because the IBM system on which the author worked had only five letters available in compiler names, not the six he needed to name his fourth language, SCHEME comes from a similar limit of six characters unable to hold the name "SCHEMER", which was the sequel to "CONNIVER", which followed the normal, boring name "PLANNER" -- all projects within the AI community. -- suppose we blasted all politicians into space. would the SETI project find even one of them?
I'm thinking that I like Lisp-like syntax more and more. It's a pitty that braces can keep someone from learning new things. But this was true for me. Ash on my head ;-)
In article <sfw9081qmfs....@world.std.com>, Kent M Pitman <pit...@world.std.com> wrote:
> The two languages are quite different in terms of how they are used, > what programming styles they promote, what community of users they > attract, the capabilities they offer, and the overall language focus.
Scheme tries to grow up. People are using Scheme for systems programming. MIT Scheme is quite a large environment. Some Scheme systems are now running on bare machines. Scheme libs now give similar power like Common Lisp. Scheme often has for experiments the advantage that it is easier to move around (-> you need fewer people).
What the Common Lisp community needs (IMHO, -> see the "MIT List"), is a small Common Lisp core (incl. threads and networking). The small core then could be moved around (different platforms, distributed computing, web stuff, new compilers, ...) much faster. It also could be the kernel for a new operating system.