Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not sure I would say Swift is the kind of robust that is needed for safety critical software, but it is a nice step forward for application code. It mostly forces you to deal with things safely while still allowing Objective-C dynamic behaviors when you need to get around the restrictions (often to interact with other Obj-C code).

So, yes I can see why one would call Lattner at the forefront of making more reliable compilers and pushing shifts in quality standards in fast-moving Silicon Valley. It is an awesome achievement to create a new language that improves both readability and safety and even more awesome to get it mainstreamed so quickly.

There are a few people who I would like to trade places with. Lattner is one of them, Musk is another. They both fulfill different parts of my long-held dreams. So I consider them to both be quite awesome. Its cool that they'll be working together too I guess.



Sure Lattner and Musk are interesting people, but I find the level of hero worship in the tech industry to be sickening.

Having used compilers for a few new languages (Rust, Go, Dart, Kotlin, Swift). Swift is the only one I've had any issues with as well as Swift seems to be the only language to have adopted the "move fast and break things" philosophy of Silicon Valley. I dunno, I just don't see the argument.


Lattner is best known for starting the whole LLVM project. Swift is just a small side project in comparison, it just got adopted by Apple for some reason.

LLVM is one of the most influential pieces of software of the past decade. Hero worship isn't good but credit where credit is due.


Are you sure no one else was involved in starting LLVM? PhD supervisor, fellow students, etc. Just saying...


Oh yea LLVM and Clang are incredible pieces of software! He is truly a master.


clang was mostly steve naroff.


You're confusing language development with autonomous vehicle development. Think of the long term goal. It's desirable to move fast and fix things with language development in the near term, to achieve a more perfect design and accelerate its maturation at the temporary cost of more volatility. After this process achieves a high level of maturity, said design principles may offer a safer, more reliable programming system that would be better suited to safety-critical applications.

Additionally I'm sure we can all agree there is no substitute for maturation through time and usage in the field. Which frankly is an argument for more popular languages over obscure ones. None of the ones you mentioned are ready for safety-critical system development (including Swift 3), but which one is most likely to achieve widespread adoption and field testing in the long run?


No I'm not confusing them. I'm responding directly to the comment that Chris lattner represents a more measured approach to software development than is tradition in the tech industry.

I don't think Swift stands to gain wide spread traction outside of Apple orientated app development. Aside from a lack of stability, Apple is to well known for boxing its competitors out. I've used and loved their products my entire life and I know how annoying it is to go against Apple's grain.


>I don't think Swift stands to gain wide spread traction outside of Apple orientated app development.

It already is though, there are several Linux web frameworks etc. It's open source and community run so I'm not sure how they're planning to box out competitors from it.


There are some web frameworks that are indevelopment. That does not mean Swift has gained any traction. Also having toyed around with one, the experience was not great.

When writing a server, I would take Go over Swift anyday. It out preforms it, uses less memory, its simpiler, oh and it uses a "tradiontal" GC.


>uses less memory

That is very much _not_ the case according to the testing I have done recently.

Swift uses a lot less memory than Go unless the program uses only trivial amounts of memory in the first place. Using interfaces in Go data structures makes the difference even more pronounced.

On top of that, all runtimes that use a tracing GC require tons of spare memory at all times unless programs are very carefully written to avoid memory allocation.

That said, Swift has a few very weak spots when it comes to memory. Most notably the String type, which is terrible on all counts, but that is a whole different story.


> On top of that, all runtimes that use a tracing GC require tons of spare memory at all times unless programs are very carefully written to avoid memory allocation.

Only if the said language doesn't allow for stack or static globals.

Quite a few languages do allow it.


Doesn't that effectively amount to manual memory management? What particular languages are you referring to?


> Doesn't that effectively amount to manual memory management?

Not really, example in Active Oberon:

    TYPE
      point = RECORD x, y : INTEGER; END;

    VAR
      staticPoint : point; (* On the stack or global *)
      gcPoint     : POINTER TO point; (* GC pointer *)
      noGCPoint   : POINTER(UNTRACED) TO point; (* pointer not traced by the GC *)
> What particular languages are you referring to?

Mesa/Cedar, Oberon, Oberon-2, Active Oberon, Component Pascal, Modula-2+, Modula-3, D, Oberon-07, Eiffel, BETA.

There are probably a few other ones.


>noGCPoint : POINTER(UNTRACED) TO point;

That's fine for one point. How about N points where N varies at runtime?

If I allocate memory dynamically outside the GC's remit, I'm going to have to release that memory somehow.


Depends on the specifics of the language.

On Active Oberon's case, those pointers are still safe. They can only point to valid memory regions, think of them as weak pointers that can also point to data on the stack or global memory.

This in safe code.

If the package imports SYSTEM, it becomes an unsafe package, and then just like e.g. Rust's unsafe, the rules are bended a bit and usage with SYSTEM.NEW() SYSTEM.DISPOSE() is allowed.

Just like any safe systems programming language, it is up to the programmer to ensure this pointer doesn't escape the unsafe package.


I still don't get how you can say that this memory is not under the GC's control but it's "not really" manual memory management either. Is it reference counting then? How does that memory get released?


It doesn't get released, unless you are doing manual memory management inside an unsafe package.

In a safe package it can only point to existing data, there isn't anything to release.

If the pointee is something that lives on the heap, it is similar to weak references. Points to GC data, but doesn't count as yet another GC root.

If the pointee is on the stack or global memory (data segment in C), then there is also nothing to release. Global memory only goes away when program dies, stack gets released on return. Memory that was allocated by the compiler due to VAR declarations, it is static.

Usually the idea is that you use untraced pointer to navigate statically allocated data structures, they are not to be exposed across modules.


It will be great if you have any benchmark to share. From what s available on internet Swift does seem to use more memory than Go.


What sources have you found on the internet?

My own code is unfortunately a bit messy and entangled with unrelated stuff. If I find the time I'm going to clean it up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: