Two Years of GNU Guile Scheme 2.0 107
Two years ago Guile Scheme, the official extension language of the GNU project, released version 2.0, a major upgrade to the implementation. As part of the two year anniversary, the maintainers organized a challenge to hack a small project using Guile in 30 days as part of a birthday software potluck. The two coolest dishes appear to be OpenGL support using the FFI, and XCB bindings built using the XML specification for XCB: "guile-xcb is a language implemented in the Guile VM that parses the XML
files used by the xcb project to specify the X protocol and compiles
them into Guile modules containing all the methods and data needed to
send requests to the X server and receive replies/events back. If new X
extensions are added to the xcb library, guile-xcb can compile and add
them with no additional work.
"
See the release announcement for details on the other dishes.
Guile supports curly-infix, too! (Score:5, Interesting)
Re: (Score:2, Insightful)
Correct me if I'm wrong, but wouldn't that break the fact that in Lisp everything is supposed to be a list? In (+ a b) it's clear to both user and interpreter what the first member of the list is, but with {a + b} the interpreter may know what is what, but the user no longer sees firsthand that the s-expression is a list like any other. The key to groking Lisp is to learn to think recursively like the interpreter, and I would think that this change in notation unhealthily forces thinking patterns derived fr
Re:Guile supports curly-infix, too! (Score:4, Insightful)
Plenty of LISPs break that "rule", and usually for the better. Clojure wouldn't be the tremendously practical and useful language it is if it didn't have vectors, maps, queues, and the like.
What's important is that the language retains isomorphism (and thus, LISP's full measure of metaprogramming power) -- as long as your parse tree and your code map 1:1, adding some additional types does no harm and a world of good.
Curly-infix-expressions are just abbreviations (Score:3)
Re: (Score:1)
From that page I see that they make the same error as Python, to allow both spaces and tabs for indentation (however I don't see any specification how tabs are treated). That's a great recipe for hard to find bugs (because you literally don't see the difference between spaces and tabs). Especially given the fact that different people tend to use different tab sizes (while traditionally a tab goes to the next multiple of 8 characters, nowadays it is usually configurable, and people do configure it).
Spaces vs. tabs (Score:3)
Re: (Score:2)
That's not simple, and I'd argue it's not sensible either. Sensible thing is to specify that there is just one indentation character, and for practical reasons it has to be space (tabs can always be converted to space only by any programming editor, but spaces can't be converted to tab-only by common editors). Problem solved.
It would be neat if all indentation was tabs, and tab width would be purely visual thing, up to each individual looking at the code, much like font is. Then meaning of tab in source cod
Re: (Score:2)
Ya, tab was a bad character to be included in the character set as it is. It is nice to have as a key though but should have been a non-printing character. Just my opinion though.
Re: (Score:2)
Re: (Score:2)
.
Python accepts either spaces or tabs, specifically because you can't get agreement on one or the other. The same argument applies here, too.
Indeed, but doing something which is basically "worst of both worlds" is neither simple nor all that sensible, no matter the reason. Fortunately practical impact is quite minor, at worst it costs a bit more work from people who have plenty of free time for such fun things anyway, when submitting or merging patches with different indentation conventions, and when tweaking editor settings back and forth.
Re: (Score:1)
There's no problem. You can use spaces or tabs, but you HAVE to be consistent when you use one or the other. So if you indent a line with a tab, all sibling and child lines MUST start with a tab... multiple spaces don't count. You can even mix, but you still have to be consistent, so if you use tab space space, all later siblings and child lines must start with tab space space.
So what happens if I start the next line with spaces?
Re: (Score:2)
This fails in practice. I don't do Python so I don't know how they solve it, but when I used Occam it was a major hassle. Problem one was that youc ould not visually see the difference between spaces and tabs and very few editors enable this (no fair using language specific editors. Additionally once you have multiple programmers touching the same file it all goes to hell, because everyone has a different notion about spaces vs tabs and tab width. Similarly, it's a pain in the ass in Makefiles, it's a
Re: (Score:2)
Actually, it turns out there's no problem.
The tools require consistency, and report an error where it's not. Then if you are a tab-only person, you can use tabs. If you are a spaces-only person, you can use spaces. If you try to use them inconsistently (tab on one line, where space was used on the previous line), then it reports an error.
Notice that this is COMPLETELY DIFFERENT from Makefiles. The problem with Makefiles is that there are cases where you can't tell where an error is, and so it quiet
Re: (Score:2)
Actually, it turns out there's no problem.
Actually, it turns out that there is a big problem.
The tools require consistency, and report an error where it's not. Then if you are a tab-only person, you can use tabs. If you are a spaces-only person, you can use spaces.
That's nice, but not everyone is a lone coder working on toy projects of no relevance which never get maintained by other devs. Here in the real world it's rare to find a single source file for even tiny (but real, not toy) projects that hasn't been touched upon by at least three different people over the course of three years.
Hell, in one system I worked on, the original comments in the source code dated from 1992 when the code was written for some 8-bit
Re: (Score:2)
You can even mix, but you still have to be consistent, so if you use tab space space, all later siblings and child lines must start with tab space space.
Speaking from experience on development teams, this still leads to problems when you have to look at the code and your editor treats the tabs differently. Allowing mixing of tabs and spaces is a really horrible idea.
Re: (Score:1)
Re: (Score:2)
As long as the braces are implemented with a macro, that's not a problem.
Braces are implemented in the reader (Score:2)
Actually, the braces are implemented in the reader. In Common Lisp terminology, they can be implemented as a "reader macro", but this is a completely different step than the Lisp "macros" usually refer to. This means that you can use {...} with data or code, and you can even use them as inputs to macros (in the usual sense). Thus, you can combine Scheme's "define-syntax" with {...} without problems. The SRFI-105 spec has some examples you might want to look at.
Re: (Score:2)
Re: (Score:2)
Lists are general but poorly performing data structures. Modern Lisps aren't all about lists at all. They have multiple data types.
RPN is scarey! (Score:1)
RPN has always scared people. It's why HP calculators don't dominate the market.
Re: (Score:1)
RPN has always scared people. It's why HP calculators don't dominate the market.
Scheme (and Lisp) uses prefix notation, i.e. the operation symbol + comes first, (+2 2). Reverse polish notation, also known as postfix notation, the operation symbol comes last, (2 2 +).
Re: (Score:1)
(is
(about 'GNU guile' (another 'cool thing'))
(support 'most recent version' (clarification (clarify 'SRFI-105'
Re: (Score:1)
{{(another 'cool thing') about 'GNU guile' } is
{'most recent version' supports
(clarification (clarify 'SRFI-105'
(developed 'Readable Lisp S-expressions Project')
Re: (Score:3)
For Common Lisp there is the "infix" package, which you can just load as part of your program. You can write infix using a #i() reader macro. Thus, #i(1+1) is equivalent to (+ 1 1), etc.
Programmers that use Lisp or Scheme for a while end up using plain prefix. The percieved inconvenience of prefix notation is due to not being used to it. After a while you realize that prefix notation is a lot more readable and less error-prone than infix.
Re: (Score:2)
Sure, for those few programmers who keep using (Common) Lisp or Scheme. But almost all developers say, "what, no infix?", and ignore or stop using Lisps. And those who stick around find that it's hard to use infix in most Lisps today because there's no standard mechanism for using it. We're working to fix that, while keeping Lisp homoiconic and general.
Re: (Score:2)
I use Haskell which has infix and prefix and does a pretty good job of letting your pass between the two
i.e. you can take infix star and write ((*) 2 3) for (2*3)
and you can take prefix f (a `f` b) for (f a b)
That being said what makes LISP, LISP is the complete lack of syntactic structures that parsing is trivial. The fact that you can write in a LISP evaluator in a few hundred lines and thus whip up a DSL inside of anything is what makes LISP. I don't mind curly braces. I don't mind Clojures additions
Re: (Score:2)
A real lisper would find (+ a b) to be easier to read and less ambiguous. This is similar to someone going to the HP calculator fans and telling them that you have a patch to allow it to work like a TI calculator, they're just not going to be impressed. The real reason perhaps is that people want to get rid of what they mistakenly think are redundant parentheses, however in order to do that you dont need infix what you really need is operator precedence, and that's an ugly bag of worms with no business ap
Emacs and Guile need each other (Score:3, Interesting)
Re:Emacs and Guile need each other (Score:5, Informative)
It's close to being reality [hcoop.net]. Guile has an Emacs-Lisp compiler to its VM that can run actual elisp programs, but lacks... the emacs part. And last summer's GSoC (perhaps this summer, finishing it?) saw emacs's lisp interpreter ported to guile... as in, the C representations of Emacs's internal data types and control structures are done using libguile. The code is currently being rebased on the latest emacs trunk; hopefully it'll see public release sooner than later.
Now the two pieces just have to meet in the middle.
So that's the first 95%. Now just for the other 95%!
Re: (Score:2)
I dunno, I still prefer Lisps with good old fashioned dynamic scoping (aka, special variables). Scheme is statically scoped and thus can be a very different style of programiming. Not that there's a whole lot of stuff in Emacs still that uses dynamic scoping, it would just feel wrong to kill off the last bastion of that style. I haven't used Guile much but I always got the impression that it was bulkier than Emacs Lisp (but then most FSF projects seem to bulk up fast, ala GNU Hello World).
Re: (Score:2)
Guile has fluids, which give you similar behavior as dynamic scoping without forcing the costs of dynamic scoping on all code. Emacs Lisp actually has optional lexical scope now, and a lot of stuff is converting to use it because it's proven to reduce code errors and runtime overhead. That, and you can't use dynamically scoped bindings to pass information between threads (a serious limitation in Emacs's implementation).
Obviously, fluids have their place in something like Emacs where the cost of breaking abs
Re: (Score:2)
So Guile isn't as tiny a scheme as the stereotype. There used to be two ends of the spectrum; pure simple scheme that's trimmed down versus all-the-features Common Lisp (which has special variables).
Re: (Score:2)
One goal does not need to interfere with the other. Emacs Lisp and Scheme are trivial to learn. Scheme is a more of a general purpose programming language. It's trivial to learn (see HERE [neu.edu])It's also worth learning simply because one of the best CS books, the SICP [mit.edu], is using Scheme. As for Emacs Lisp, I don't see a need to get very deeply into. Scheme is nicer and more simple. Emacs Lisp is the language much of emacs is written in as well as its modules. Unless you have in mind writing Emacs modules, picking
Re: (Score:2)
If by mainstream you mean professional. Common Lisp stagnated and until Clojure there really wasn't a LISP with professional libraries. The LISP community all during the 1980s and 1990s simply didn't want to make the compromises needed to have a mainstream language. I think that in many ways Haskell has taken the role that LISP used to play in terms of language of the future.
If by mainstream you mean educational. It is a pity. Racket is fantastic for educational scheme. The AP exam is based on Java, b
Re: (Score:2)
Common Lisp only had a few years of stagnation... It more suffered from being a decade ahead of its time so folks took "you can still run code from 1995 in the aughts" as a sign of decay instead of stability. Of course, it never really did regain the GUI capabilities (except for Clozure on OS X) the proprietary stuff had since the whole compiler/tools industry just collapsed suddenly.
I've used CL professionally, and I'd put it on par with C++ for that... powerful, well supported, without the annoyances of J
Re: (Score:2)
I don't know about that. QuickLisp may have solved so of this but the situation was bad for many years. Have you gone through something like Perl or Java library collections to see what a full set of libraries looks like? It isn't just GUI is it everything.
A far as IDEs, yeah it is a problem for most non static languages. The static Algol based languages have the best IDEs. Clojure has fairly good support because of its ties to the Java community, you might want to check that out. I keep my eye on htt [leksah.org]
Re: (Score:2)
> I wish that the project, talked about for years, to rewrite Emacs and base it on Guile would take off. It would save Guile
Exactly, and this is exactly its problem. It is not the Emacs people who are pushing this rewrite, but the guile people. in order to get a "killer app" as a vehicle to advertize Guile, because nobody else wants to write a killer app in guile from scratch.
Of course, Emacs would benefit from an vastly improved Elisp engine too, but my feeling is that the usual Emacs users actually do
Scheme rocks, but lost the race (Score:3)
I love Scheme. I even wrote my own scheme interpreter way back and used it as the embedded control language in QuickLogic's P&R tools. However, only software geeks like Scheme, making it a terrible language for tool control for anything but software dev tools. TCL beat the heck out of Scheme in terms of popularity for this purpose. Python beat the heck out of Scheme as well. Perl got adopted by the text mashing crowd. Also, Guile, at least in the 1.0 version had issues. For example, it really wanted to have main in it's code, while your entire application was something it called. TCL has a better architecture for embedding. Anyway, this is nice, but I don't personally see a significant future for Scheme.
Re: (Score:2)
So just wait. Lisp might yet be the winner that replaces the rest of the bunch and XML as well.
People were saying almost the same thing 20 years ago (except not about XML; work on that started in 1996). How long do we have to wait? Is it just the case that Lisp is the programming language of the future, and will always remain so?
Re: (Score:2)
Ruby kind of messed up blocks though, which makes closures a bit messy. It seems like Ruby wanted to copy Smalltalk but in a more textual style, but then it messed out on flexible blocks. Ie, Ruby blocks only at the end of an expression and to turn a block into a first class object you have to jump through some hoops. Compare to Smalltalk's "[a block] on: Exception do: [another block]".
Re: (Score:2)
Python doesn't have lambda expressions or first class functions. Python is far less like Scheme than it was 15 years ago.
Re: (Score:3)
Huh? Here's Python's lambda expressions. [python.org] And of course, from the fountain of all knowledge, Python has first class functions [wikipedia.org]. Now, that said, it's still not Scheme.
Re: (Score:2)
fs = [(lambda n: i + n) for i in range(10)]
fs[3](4)
returns 13
should be 7.
Python has a broken non-functional semi lambda. This has been an issue of controversy.
_____
I didn't realize they added partial application. I'll take my comment about first class functions back.
Re: (Score:1)
I've seen a lot of higher-order and first-class written in Python, but I've always been able to model semantic flows in LISP and Scheme faster. Half of what people need in that kind of model could be done in Prolog, and the rest could be done in OCaml or Haskell; however, how many commercial shops have more than a token programmer who might have a dusty tome of such arcane knowledge?
Different OSes, programming languages, methodologies, techniques for different problem domains.
Diversity is good. Monocultur
Re: (Score:2)
Monoculture is pervasive. Sometimes it shows up just with all the currently popular language following the same old style with just minor variants in syntax. You get a batch of developers all used to Java or C++ or Python and so every new language they create just can't help but resemble that style. There just aren't that many programmers any more who have used languages that are radically different from that style, much less many programmers who are experts in those languages. We need more devs who are
Re: (Score:2)
I'm just guessing that you and I are of a similar age (I'm 49). Ken McElvain said that Lisp ruined me. Even when coding in C, I program in Lisp. I love Prolog, and wrote a tiny version of it at one point. I never learned Smalltalk, and suspect I missed out on something huge, but I love Forth and of course had to write my own version. As for Fortran, my first programming job was in Fortran IV. Some of the most brilliant people I've ever known are physicists who continue to program in Fortran to this da
Re: (Score:2)
I think TCL really broke things. I was used to ARexx when it came out and it was vastly simpler to embed than TCL, and TCL felt always like it wanted to be in control (the thing you accuse Guile of doing).
Re: (Score:2)
Anyway, this is nice, but I don't personally see a significant future for Scheme.
Never say never.. Back in 2000 I thought JavaScript was just an insignificant programming language for adding simple dynamics to a web page, like drop down menus, validating input, etc, a web designer's tool, not a serious coders tool, and see how things have turned out. JS is probably now one of the hottest programming languages, despite all the drawbacks. Next, who could have imagined a Lisp dialect (Scala) running on top of
Re: (Score:2)
Scala is on the bubble for being a mainstream language. I'm personally very excited about it. I wouldn't call it a Lisp dialect... just highly lisp influenced. However, I'm totally ignorant of Scala's history. Lisp lives on in many languages.
Re: (Score:2)
Duh, I just accidentally wrote Clojure instead of Scala. Those two somehow crossed in my mind, both being JVM languages, as I was writing this.
Re: (Score:2)
Re: (Score:2)
Re: (Score:3)
Once you get used to it, Scheme (or any other modern Lisp) is a very easy language to write clean, effective code in.
Scheme is great but the problem is I'm a crap programmer. So a language that helps with the code I write is not as important as a language that helps because of all the code that I DON'T have to write.
Basically I prefer to pick a language where there are already tons of existing good libraries/modules/code I can _easily_ use to do what I want. Stuff written by better programmers than me. That way the effective quality of my program goes up - since much of the functionality/code is actually written by someon
Re: (Score:2)
> Scheme is great but the problem is I'm a crap programmer.
Actually the first sign of a great programmer is realizing they are not great ! :-)
THE key point that everyone forgets: We were ALL noobs at one point. You don't really master a language until you've been using it for years.
> prefer to pick a language where there are already tons of existing good libraries/modules/code I can _easily_ use to do what I want.
Yup, that's very pragmatic. However, I would add, EVERY programmer should know how to or
Re: (Score:2)
Addendum: All Lisp and C programmers should watch the video:
Readable Lisp S-expressions: Curly-infix-, Neoteric-, and Sweet-expressions
http://readable.sourceforge.net/ [sourceforge.net]
Re: (Score:2)
However, I would add, EVERY programmer should know how to or have at least once in their lifetime written atoi() and the corresponding dual itoa() aka, printf.
There's also the version for people who think they're smart: do the same for floating point numbers. (Experts only: use only the minimum number of digits when converting to a string.)
Re: (Score:2)
Actually I never liked that style. I can learn a language inside and out and know it's nuances, but that is useless if it turns out the only thing that language is used for is to tie together building blocks that are pre-built by someone else. With a lot of environments it seems it's more useful to know the frameworks and libraries that the project is using than to know the language itself.
Re: (Score:2)
Imagine writing your own xml parsers, configuration file handlers, log handlers, high performance ACID databases, web servers, networking libraries, GUI libraries, "OpenGL", etc. Or even operating systems. Even if Scheme is ten times more concise, it'll take a lot of time to write it all yourself.
If learning to use the libraries/frameworks would take longer than to do what you want from scrat
Re: (Score:2)
Clojure is a LISP that can use Java libraries.
I don't know if that helps but there finally is a LISP with a good modern set of libraries.
Re: (Score:2)
It is popular. You can find stuff all over the web.
And there are books: http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=clojure [amazon.com]
Re: (Score:2)
Huh what lisp functional programming whaa...?! LISP is as imperative as it gets. The key feature of LISP is that code is data. That way you can run complex things at compile time -- things that write code for you, generate tables, implement domain specific languages, etc. The functional features are an afterthought and not really in any way key to LISP's power. They are a commonplace in most languages these days. I mean, come on, once you have function pointers in C, you can directly emulate all of LISP's "
Scheme is a functional programming language (Score:2)
Re: (Score:2)
It may be well-written code, but given that it's only quite recently that we have garbage collectors that can cope with pure-functional-style memory pressures, nobody in practice writes large LISP projects in functional style -- at least not projects that are not very recent. I can't wait for LuaJIT's new garbage collector to be done -- if it could be then "reshaped" to serve a LISP system like SBCL, it'd be a major win IMHO.
Scheme != Common Lisp (Score:2)
Re: (Score:2)
Tail recursion is not the problem I refer to. Merely the amount of garbage generated just making copies of stuff is what's killing it. Even Oracle's Java deals with it relatively poorly -- thus the presence of hardware-assisted garbage collection (at a price tag that'll make you weep). Open source implementations generally don't really have garbage collectors that address the architectures of today's CPUs. They are definitely not optimized for cache pressure, and are simply wasteful in their resource use. E
Re: (Score:2)
Huh what lisp functional programming whaa...?! LISP is as imperative as it gets.
Indeed. I think Scheme is closer to the functional ideal. It was designed to simplify the functional style programming while still giving you access to imperative features. One reason is proper tail recursive calls which are part of Scheme standards, which is not something Lisps always give you.
Lambda is very nice syntactic sugar, but not impossible to live without. Same goes for continuations: it's possible all right to have c
Re: (Score:2)
What I'm merely saying is that functional programming is more a matter of what the developer does, rather than what the language offers. Sure as heck I detest anything where the code is far flung from what is meant, so no, I do not advocate using plain C :)
Re: (Score:2)
This is because C, C++, Perl, Java, C#, etc, even Python are implementing many of the same paradigms. They all descend from C. Lisp and Scheme are completely different from those. Lisps are the oldest high level programming languages. They have been around since 50-60s. No wonder they look different. Nonetheless, Scheme has one of the simplex syntax rules ever. It's just dead simple and unambiguous. For example, there is no operator precedence. You can write a Scheme interpreter in 100-200 lines of code in
Lame joke alert! (Score:1)
I guess Guile Scheme...
(puts on sunglasses)
does go with everything.
Re: (Score:2)
Re: (Score:2)
How many of those are using Guile 2 yet? Zero as far as I can tell.
To be fair, Guile 2 is a huge upgrade from Guile 1. Internal are completely different. Such transitions will take a long time. It's fair to assume that some will never switch from Guile 1. Not every application needs an uber advanced and fast extension language like Guile 2 (and it is very fast IMO, as far as scripting languages go).
Re: (Score:2)
The main impediment to adoption I think was barely missing the Debian Squeeze and the last set of distro releases... but it made it into Wheezy and I think is in every other major distro's latest/upcoming release.
The perils of distro release cycles...
Re: (Score:3, Informative)
Only in my happiest, wildest, wettest dreams.
Re: (Score:1)
Java, not JavaScript. They are completely different. Netscape just used the Java name since it was trendy back then.