News for hackers. Stuff that matters.
Re:D as a Better C by pjmlp on Wednesday August 23, 2017 @12:39PM (#15082942)
You can easily get best of both worlds with Lisp derived languages.
Re:D as a Better C by sythe2o0 on Wednesday August 23, 2017 @01:21PM (#15083327)
It's been my understanding that Lisp and its relatives aren't designed to compete against C for speed either. Is this wrong?
Re:D as a Better C by pjmlp on Wednesday August 23, 2017 @02:20PM (#15083813)
C was designed on a PDP-11, a computer much more powerful than the mainframes where Lisp was already running since 10 years, so Lisp implementations were already quite good for most tasks by then.

While C designers were trying to create UNIX at AT&T, Xerox PARC was busy creating Smalltalk, Interlisp-D and Mesa/Cedar.

Other companies were creating Genera and the Connection Machine,

In the end Worse is Better won, because the machines were too expensive for most pockets, normal developers could not grasp Lisp, mismanagement from those companies and UNIX was kind of cheap when comparing prices, with source code available almost for free (AT&T was prevented from selling it early on).

Re:D as a Better C by flavio81 on Wednesday August 23, 2017 @06:58PM (#15085934)
"How to make Lisp go faster than C" (2006) http://www.iaeng.org/IJCS/issues_v32/issue_4/IJCS_32_4_19.pd...

And these figures aren't using the SBCL Lisp compiler which should currently be faster than the one cited.

You are correct, it wasn't designed to compete against C. And it has a garbage collector. But make the right choices and a compiler like SBCL can produce surprisingly "clean" (optimized) machine language code.

Re:D as a Better C by saghm on Wednesday August 23, 2017 @08:54PM (#15086714)
C compilers have presumably gotten faster since then as well, of course
Re:D as a Better C by steinuil on Wednesday August 23, 2017 @02:45PM (#15084026)
Common Lisp has some very fast implementations (I think SBCL is the fastest) and it was designed to be a systems language. It can be optimized to be as fast as C.
Re:D as a Better C by rifung on Wednesday August 23, 2017 @03:24PM (#15084324)
> It can be optimized to be as fast as C

Sorry if dumb question but how is this possible when it's garbage collected?

Now I really feel like I need to learn a Lisp though.. Is there a certain Lisp you would recommend that's practical enough I'd use it for projects? Racket?

Re:D as a Better C by pjmlp on Wednesday August 23, 2017 @03:57PM (#15084536)
You can start by reading about Genera and Interlisp-D

https://en.wikipedia.org/wiki/Genera_(operating_system)

https://www.ics.uci.edu/~andre/ics228s2006/teitelmanmasinter...

http://www.softwarepreservation.org/projects/LISP

Just check the hardware capabilities of systems having Lisp 1.5 support, several years before C was created.

Lisp is not only manipulating lists, it grew up to natively support all relevant data structures, including primitives to handle systems programming tasks.

Regarding GC and systems programming, there are plenty of GC enabled systems programming languages, the main point is that they offer features to control the GC and also do stack and GC free allocation if required.

Some examples would be Mesa/Cedar, Modula-2+, Modula-3, Oberon, Oberon-2, Oberon-07, Active Oberon, Component Pascal, Sing#, System C#, D

Re:D as a Better C by flavio81 on Wednesday August 23, 2017 @07:02PM (#15085967)
> Sorry if dumb question but how is this possible when it's garbage collected?

On a big or complex system you end up at least doing one or both or two things:

a. Having to manage many temporal (transient) objects in memory. Thus you end up doing some sort of garbage collector, either doing it yourself, or using the facilities provided by the languages, or a library.

b. Allocating fixed big blocks of memory (such as arrays, or doing a "malloc") and then using this block of memory as your storage area, which then you manage.

Usually on C programming you do (b), although you can also do (a), it is not so easy.

Usually on Common Lisp programming you do (a) very easily, but you can also do (b) by allocating an array and a bit more stuff. It is not difficult, really.

Re:D as a Better C by steinuil on Wednesday August 23, 2017 @07:16PM (#15086059)
> how is this possible when it's garbage collected?

Common Lisp lets you give "hints" to the garbage collector, so you end up with pretty much what you'd have in C but without the manual memory management.

> Is there a certain Lisp you would recommend that's practical enough I'd use it for projects?

Racket is very nice and comes with great documentation, a huge standard library and a very handy IDE. Clojure was hyped a lot so it has lots of libraries, which however might be of dubious quality or unmaintained by now, and it's on the JVM, which might or might not be a good thing for you. Common Lisp is very versatile and "pragmatic", but lacking in external libraries.

Re:D as a Better C by Keyframe on Wednesday August 23, 2017 @03:27PM (#15084344)
I like Lisp, though Scheme in particular. However, I have no idea where I would turn to in order to write an application with GUI that needs to be cross-platform and, possibly, derive a mobile version for iOS and Android from the same codebase.
Re:D as a Better C by pjmlp on Wednesday August 23, 2017 @03:46PM (#15084467)
Re:D as a Better C by saghm on Wednesday August 23, 2017 @04:22PM (#15084727)
Given that GP said "cross-platform" and then separately "possible derive mobile", I'm guessing that only supporting OS X on the desktop might not be enough for them. That being said, I'd be very surprised if there weren't cross-platform desktop GUI libraries available for Common Lisp.
Re:D as a Better C by Keyframe on Wednesday August 23, 2017 @04:35PM (#15084826)
I'd be shocked if WxWidgets weren't supported, maybe even Qt.
Re:D as a Better C by Keyframe on Wednesday August 23, 2017 @04:37PM (#15084843)
Interesting, but premise seems to be that UI code should be done outside of Lisp. Whereas, at least in my experience, this is where most code and trouble lives.