Hacker Newsnew | past | comments | ask | show | jobs | submit | jckarter's commentslogin

Looking at the generated code, we have a couple issues that prevent full optimization. One of them I already knew about (https://bugs.swift.org/browse/SR-2926) -- as a debugging aid, we guard every trap we emit with the equivalent of an `asm volatile("")` barrier, because LLVM will otherwise happily fold all the traps together into one trap. We really want every trap to have a distinct address so that the debugger can map that trap back to the source code that emitted it, but the asm barrier prevents other optimizations as well. As for `reduce`, it looks like the compiler does inline away the closure and turn the inner loop into what you would expect, but for some reason there's more pre-matter validation of the array than there is with a for loop. That's a bug; by all means, reduce is intended to optimize the same.


Clay is a lot more flexible and metaprogrammable than Rust. Clay allows ad-hoc overloading with predication based on arbitrary compile-time computation, whereas Rust's polymorphism support is more strictly based on Hindley-Milner parametric polymorphism and type classes. On the other hand, Rust, by baking features like shared/unique pointers and logging into the language, is able to provide much stronger safety guarantees with a much simpler type system than Clay would need to provide the equivalent guarantees. Rust also requires a runtime, which supports some cool features like lightweight tasks, cycle collection, and builtin logging, whereas Clay sticks to a "no runtime other than libc" mandate. Overall, Rust will probably be a much better choice for large-scale application development than Clay. The cool thing about Clay is that it's like a scripting language for LLVM. It's great for flexibly generating small amounts of native code without runtime dependencies.


This certainly piqued my interest. Do you reckon that eventually some of the interesting features (such as tasks, channels and smart pointers) of Rust could be implemented in Clay as libraries, with type safety and everything?


Clay has shared and unique pointer implementations in its library. Naive channels could be mostly implemented in the library as well, but I think they might need language support to pull some of the tricks Rust and Go do to make them fast, and Clay's type system would need to better guard against unintended sharing to make them safe. The Rust and Go developers are contributing the groundwork for lightweight tasks into LLVM, so with runtime library support Clay could potentially inherit that support. I think a region type system would fill in the safety holes; the Deca language (http://code.google.com/p/decac/) is very similar to Clay (no runtime requirements, variant-based dynamic dispatch) and successfully uses region typing to provide safe memory access.


What build information is missing? The README.txt describes how to build the compiler; it's a fairly typical cmake setup.


Yep, I'm an idiot. I grabbed the binaries from the official site instead of from the repo.

I was tired.


You're correct; Clay's type system doesn't help much with memory safety. It's flexible enough to express RAII-based ownership semantics like C++, so you can manage dynamic memory with reference counted, uniquely-owned, or other policy-enforcing pointer objects, but also like C++, the language doesn't prevent you from taking nonowning references to arbitrary data behind the type system's back and using those references after the owning object has freed the data.


The more fundamental mismatch is that they're testing an interpreter (libc's printf implementation) against a compiler (pypy's format string jit). A C++0x or D library that parsed format strings at compile time would likely still beat pypy.


But Pypy can optimize dynamic strings, while a static compiler can't.

Replace the constant string with argv[1], and run the code: for Pypy, there is no real difference, but the C/C++/D compilers are unable to optimize.


I think this is still a library problem, not a language problem. "Compiling" a string at runtime for `sprintf` isn't any more difficult than doing it at compile-time, and plenty of regex libraries do very similar things.

Compiling of printf strings isn't done, though, because nobody cares about string performance unless they're writing UNIX command-line utils. If you're writing C you're probably only dealing with strings for (infrequent) IO, spending the vast majority of your time crunching away on pointers and integer types (floats in niche cases). In the end, you're probably only printing something out because someone needs to read it, and how fast can humans read, anyway?

This goes just as much for the printing of floating point numbers. (http://www.serpentine.com/blog/2011/06/29/here-be-dragons-ad...)


jashkenas (CoffeeScript author) replied to you, but for some reason he's deadbanned:

> Thanks for mentioning it -- the fix was actually to correct a regression from a previous commit, not a true bugfix versus 1.0.1. I've removed that line from the changelog.


Cool, thanks for clarifying.


I (now) know that Red Dead was banned in the UAE, and pictures of the US military dead are banned by the Pentagon, but what is 'deadbanned' in this context?


If you're banned here, you aren't locked out of the site or prevented from posting. Your posts are just marked so that only you (and other users who have chosen "show dead comments" in their preferences) can see them, and there's no indication that you've been blacklisted. It's terrible.


It's C++ and of course dependent on Unix/Windows memory mapping APIs, but you might like asmjit: http://code.google.com/p/asmjit/


Not everywhere needs to become Silicon Valley. IT is well-trodden ground with established players and power centers now. Smaller cities like Portland would do better promoting emerging industries than trying to catch up to the web startup bus 15 years after it left the station.


I don't think everywhere needs to be SV. But, I do think that the power centers are less important in the web space. Web ideas can be built, launched and highly successful in very short periods of time. When that is possible, the actual location of the startup is less important... so long as they have a great community to support them. NYC is catching up to SF. Chicago / Austin / Boulder are having success growing great startup communities.

I'd just like to see Portland's scene improved.

And RE "Smaller cities like Portland would do better promoting emerging industries than trying to catch up to the web startup bus 15 years after it left the station."

It may have left 15 years ago, but if you run your ass off, you can still catch it.


You say you want to see Portland's scene improve, but I might suggest what you are really asking for is Portland's scene to change. I am a web developer here in Portland (been here for 10 years, love it). I do freelancing and don't run a startup, so obviously we're in different situations, but in my opinion what makes Portland Portland is its ease of living -- cheap rent, good cheap food, low traffic, mild climate, and most importantly: an utter lack of ambition. I grew up in the NYC area, and the difference is striking (it's subtle, but very pervasive) -- people just don't really care that much about achieving extraordinary things. And I don't mean this in a bad way at all -- I don't think there's anything intrinsically good or bad about being super ambitious, it's just a choice that we all make for our own goals and personalities. So it makes a lot of sense to me that Portland doesn't have a startup culture anything like S.V. -- and I feel that if it did, it would cease to be Portland.

BTW, this is coming from a place of respectful discussion and sharing of opinions -- I work downtown, if you ever want to meet up for coffee and discuss more, that would be fun (contact info in my profile).


I definitely want a part of Portland's scene to change... Not the entire scene. I too love Portland for "cheap rent, good cheap food, low traffic, mild climate..." But I'm ambitious and have friends are as well. I realize that this isn't the main attitude (and I'm agreeing that being one way or the other isn't good / bad.) that Portland has. What I want is a better community for those in the web startup scene to be better supported to try and change the world.

Always happy to discuss. I'm in Portland every month or so. And I love coffee.


SV is a special place that combines all sorts of things: talent, capital, ideas, culture. Most places lack one or two of these things. For example, where I live I'd say all but the ideas are lacking. The point is that Portland could be the biotech, health care systems, green energy, transportation,etc powerhouse with capital. The lack of capital effects all industries equally.


For the sake of conversation I might say that you can replace "Portland" with any city in the US. As I mentioned in the post (A Startup Community Needs 4 Things: Ideas, Talent, Ambition, and Capital.) You can probably find greater and lesser amounts of each in any city. And like Portland, most will be shortest on the Capital. But the capital world is changing and I think there will be more opportunities for startups to get off the ground wherever they are based.


Orthogonal to bloat, libstdc++ is a large, ugly, and hard-to-audit attack surface that I'm sure OpenBSD is glad to push out of core.


libstdc++ remains as much a part of core as it ever was.


But if nothing links with it, so there are no executables using it, that would seem to reduce the attack surface.


The attack surface of "there is groff in /usr/bin" was never very substantial.


Get root to run "man foo" with the right manpath...


I see. So does this purge only consist of compiled executables then, with the standard C++ headers and libstdc++ still getting a pass?


I think it's rather sad that HN has mostly ignored the meat of this story, and is instead focusing on a not entirely true one line throwaway.


Sad, but understandable. "OpenBSD writes their own ROFF interpreter" isn't very interesting, but "OpenBSD purges C++ from core" appeals to developers' strong emotional responses toward C++.


Yes. And it's not so much a C++ purge as it is a "unmaintainable GPL-licensed slow software" purge, as far as I understand. C++ does hurt comprehension, but it's not the main complaint.


Wait... so then libstdc++ isn't written in C++? Or is "core" different from "base"?


Option 3: core/base is not actually free of C++.


Every Mac still ships with Xcode on the OS install disc, as do the OS X upgrade discs. Let's wait until Lion comes out before assuming that won't be the case anymore.


The MacBook Air doesn't ship with Xcode.


I have a current model 11.6" Air purchased in January, and Xcode was pre-installed into /Developer.

This was a stock machine: walked into Apple Store to buy it. (No special factory config)

Compiling SBCL and a few items from MacPorts worked fine, so everything seems consistent with what I've seen on other Macs since 2005.


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

Search: