Hacker News new | past | comments | ask | show | jobs | submit | afternooner's comments login

Yea, I liked the idea of what go was waning to do. They wanted classes and objects without the classes and inheritance, but all they've done is replace that headache with an interface headache.


Okay, can someone who understands this explain it a little better. My understanding is that ARC (or automatic reference counting) wasn't garbage collection because there isn't any garbage collection. I had thought that ARC was a compiler optimization that would analyze your code and add the deconstructor code while compiling based off some possible usage graph or whatnot. ARC therefore is not garbage collection. Yes, it's memory management, but to link the two as the same is wholly inaccurate. Please chime in to let me know how wrong I am.


This is not how ARC works. ARC keeps a count (at runtime) of the number of references to dynamically allocated objects. Every time you create a new reference to an object, the count is incremented, and every time a reference goes out of scope, the count is decremented. When the count reaches zero, the memory is either freed immediately or marked as free-able for later.

Your bit about compile-time code analysis to automatically insert the cleanup code when data is no longer reachable is actually pretty similar to what Rust does today with owned pointers. The downside is that this doesn't work with "normal" code -- you need certain annotations for the compiler to be able to perform this task correctly. In Rust this is done via region pointers (lifetime parameters) and borrow checking.


The canonical text on garbage collection by probably the most respected person in the field considers reference counting (automatic or otherwise) to be GC (http://gchandbook.org/contents.html). I know that's appealing to authority, but what else can you use to prove the definition of a term? Also see [1], which argues these algorithms are all the same thing anyway.

[1] D. F. Bacon, P. Cheng, and V. T. Rajan, “A Unified Theory of Garbage Collection,” presented at the Proceedings of the 19th Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA), 2004.


While we can acknowledge that the more expansive definition of "garbage collection" includes ARC, we can still simultaneously hold another definition of "gc" to not include ARC when discussing Apple & Swift. That's the way Apple documentation and most others are using that term.

Apple docs:

"Garbage collection is deprecated in OS X Mountain Lion v10.8, and will be removed in a future version of OS X. Automatic Reference Counting is the recommended replacement technology."[1]

[1]https://developer.apple.com/library/ios/releasenotes/objecti...

[2]http://lists.apple.com/archives/objc-language/2011/Jun/msg00...

If we don't use the more common understanding of gc, Apple's documentation doesn't make sense. If we do a substitution of Apple's verbage using ARC==GC, we get nonsense such as:

"Garbage collection (which includes ARC) is deprecated in OS X Mountain Lion v10.8, and will be removed in a future version of OS X. Automatic Reference Counting (which is also part of garbage collection) is the recommended replacement technology."

With the insistence on ARC==GC, we'd have to parse that sentence as garbage collection is being removed and replaced with garbage collection.


It would be nice if we not redefine the meaning of computer terms that have be understood for decades. I know it's semantics, but I take the definitions I learned 20 years ago in my college comp-sci textbooks as the agreed upon definition.


Others would take the definitions They learned 10 or 50 years ago in their college comp-sci textbooks as the agreed upon definition, and those differ.

For example, what I learned decades ago doesn't include that 2004 paper that convincingly shows reference counting to be one end of a scale that has pure GC at the other end.

Yet, that paper made me realize that reference counting is, in some sense, garbage collection.

On the other hand, I see no big problem in having an ambiguous term. That happen all over the world, also in science. Chemists have 'alcohol' (ethanol) vs 'an alcohol' (a family of compounds that includes ethanol), mathematicians have words such as 'algebra', biologists have roses as a family of plants and as a subset thereof, etc.


Before ARC they used manual reference counting. At runtime each object has a count of how many things have declared they have a reference to it. You can increment that count by doing [obj retain] whenever you know you're keeping a reference to it that will outlive the stack frame. When you're done with the object you can do [obj release] to decrement the counter. When the counter hits zero, the memory for the object can be freed (I don't actually know if it's done immediately or added to a list of objects to free later).

What the automatic part of ARC does is, at compile time, analyse the code and automatically add the retain and release messages. If it determines the reference will outlive the stack frame, it adds a retain message. if it determines the reference can no longer be dereferenced (maybe because another object reference is assigned to that variable) it adds a release message.

The runtime characteristics are the same as ARC, it just means the programmer no longer needs to work out where to add the retain and release messages (though they still need to think about reference cycles).


On containers, while it's entirely possible to constrain the type, it's also possible to use AnyObject

    var example = Dictionary<Int,AnyObject>()
I'll miss the duck typing, but having bought my house off C# work, I can work with this.


The first time I saw this idea was in Rust, which calls its type Any. I haven't seen the need to use it yet, but this seems like a decent case.

What other languages have this? How is it often used? I've never heard of a similar type in, say, Haskell.


In Java, everything extends Object, so something like List<Object> will let you put anything you want into it. I should play with more languages, I didn't realize that was an uncommon feature.


Oh, duh, of course that's true. For some reason "the parent class of every class" is different than "a type explicitly for any type" in my brain.


>For some reason "the parent class of every class" is different than "a type explicitly for any type" in my brain.

Good, because types and classes are different things despite what languages like Java and my beloved C# would have us to think.


To clarify:

"Object" as in Java is a type for any tagged box type. Primitives, such as "int", don't derive from Object, but can be promoted to a corresponding boxed type, such as "Integer".

The story is a little more complex in C#, where ValueType derives from Object and "value types", both primitive and user-defined, are truly subclasses of Object. Types not derived from ValueType are considered reference types.


This is a consequence of lack of generics and comes from Smalltalk.

In languages where genericity is supported, you don't need a common base class with a pre-defined set of methods, as you can give type constraints.

Java could also have done it with interfaces, but those were the days OO was becoming mainstream and interface (component) based programming wasn't yet well understood.


Haskell does have an Any type, but because of it's functional nature it's not as useful as in an OO language.

http://stackoverflow.com/questions/6479444/is-there-a-type-a...


Scala also has a unified type system. The root is Any. AnyVal (primitives) and AnyRef (AKA java's Object) extend Any.

Int is always Int instead of thinking about int and Integer. Scala handles boxing when the JVM requires it, but it is invisible to the programmer.


Julia also has a useful Any type.


I could argue that if you work for the DOD, it's entirely possible that all your code will only execute once. Sadly, I do work for a government agency, but my code only runs once because of mismanagement... :(


Oceania here we come.


Question for those who understand this, why can the government force a middle man to exist in the first place? It seem to a layman to violate several other rights.


Planet Money has a great podcast explaining the reasons why car dealers exist.

http://www.npr.org/blogs/money/2013/02/12/171814201/episode-...


I'd really like to know what the legal framework is for securing a market position by law.

I constantly hear the argument that by codifying contemporary business models they've secured jobs.

Using this logic we should still have manually switched phone networks where people move around cables on giant boards all day long and rooms full of people using typewriters who have to start over again if they have a spelling error. There should be artificial $1 taxes for emails to keep the physical post in business and other nonsense.

I really don't see how the argument is valid.

I'm just surprised that there isn't some landmark labor case that would invalidate laws which artificially perpetuate inefficient vestigial processes or explicitly ban a market from evolving.


What would the legal argument for invalidating the law be? There is no constitutional right to efficient markets that would lead the supreme court to strike down the law. I think the court would declare this a "political question" and refuse to grant cert thereby not ever hearing the case.


I was thinking it would have been from English Common law - you know, from like the 14th century or so.

I find the reasons presented for these types of laws to always be patently absurd when generally applied and it just seems like an obvious shoo-in that should have been there since like the hundred years war.


Why would there have been anything about efficient markets back in the hundred years war? Adam Smith wasn't publishing until around the French and Indian war (AKA 7 years war) 300 years later.

Also, what leads you to believe that creating economic inefficiency to the benefit of some special interest is somehow against ancient and established traditions?


>Using this logic

Well, that is the logic. And you'll note that, despite that logic, we have the internet, cell phones, and the national postal services are going bankrupt.

There's a tenuous balance between maintaining global competitiveness and promoting technological advance, and making sure that your middle-class have blue collar jobs that afford them the ability to participate in the financial gains of of your nation.

The changes will occur; you can't hold them back. But sometimes you have to ease them in. It does the world no good to put thousands of "luddites" out of work overnight. The idea that they'll "find other work" makes sense on the macro level, but not the micro level; transitions take time.


Car manufacturers created the franchise system as a way to avoid them having to carry the cost of vehicle inventories and repair facilities across the country. Having done so, the dealerships lobbied the state legislatures to formalize their status in law, so that they couldn't be disintermediated by the manufacturers later.

I believe that the argument in their favor, other than blatant self-interest, was that dealerships provide post-sales warranty service, which would otherwise not be readily available. In some states, IIRC, the statutes are written to say that vehicles can only be sold from a location that also offers warranty service.


Dealerships have always felt to me to be some of the sneaky-est, deceptive and sometimes shady businesses I've had experience with. I think direct sales from manufacturers makes more sense...


I think the part most people are having trouble with is not what is contained in your first paragraph, but how the legislature/executive goes from there to "Every manufacturer, including those that never set up franchise agreements, must sell through a dealership." The especially galling part of the New Jersey kerfuffle is that Tesla was defined to be a "franchisor" despite the fact that they have never entered into a franchise agreement!


If Tesla attempts to prevent independent service facilities from providing warranty and service work then be very worried. Laws exist to give consumers the choice for a reason.

With multiple dealers at least you can choose which one to buy from, who has better people, better service, and better pricing. Why people want Tesla only stores is beyond me, one choice means no choice.


It's not about wanting only Tesla stores. It's about wanting Tesla stores at all.

If consumers really do value dealers, then dealers will continue to exist. The reason that dealers are scared is that the dealers themselves do not believe that they provide a valued service.


TL;DR: To save y'all from listening to the (interesting) Planet Money podcast:

Back in the early C20 depression the auto makers were the biggest companies in the USA. And they'd force the franchisees to purchase cars or lose their franchise.

So states enacted legislation to ensure the auto makers couldn't close a franchise. Nor could the auto maker grant a second franchise in the same location. And (I think I'm inferring as I can't remember hearing this explicitly) could not open their own dealership that competed with the existing franchise.


A great example of "The Law of Unintended Consequences"?

A law meant to help the people, hinders the people later on. Getting this stuff right isn't easy.


Which rights would it violate? (specifically, those that have been enumerated in the US or NJ constitution, or have been affirmed by a court).


The equal protections clause, as other people are not required to sell through an independent middle-man. Perhaps the due process clause as well, depending on how the statute is written and enforced.


I don't believe the equal protection clause would be applicable. All residents of New Jersey are subject to the same standards, and the state would be able to articulate a rational basis for the restriction (ensuring consumer access to repair and warranty service, for example). Same with the due process clause, the state merely needs a rational basis, or a "legitimate governmental interest", which is reasonably trivial for consumer protection legislation.


State commerce seems like a much more reasonable limitation on states rights as dealerships are in effect a tax on imports from another state. Presumably, consumer protection rules like forcing any place that sells cars to also repair them, but states can't for example prohibit someone buying a car in another state.


Government is the biggest middleman in existence.


Middlemen implies no or little value derived from the middleman's place. A stable, powerful and secure government is required for value of any meaningful value to exist in the first place.


Why can the government force a middle man to exist in the first place, that doesn't seem in line with capitalism at all?


Any form of government intervention in the markets is out of line with pure capitalism, e.g. farm subsidies; import taxes; bailouts of the auto and finance industries; medicare; medicaid; social security... one could make an argument for Fannie Mae and Freddie Mac as well.

That's not to say that the above are not reasonable policies for an advanced western economy, just not that they could reasonably be considered purely capitalist.


No, there is no "purely capitalist". You confuse "laissez-faire capitalism" with "capitalism". If what you say is true, "laissez-faire" would be a superfluous adjective, like calling it "capitalist capitalism".


There's no American law stating "the US economy must be capitalist." "Capitalism" is just the rough description we assign to the US economy. The principles are there, but there are many exceptions.


What I'm more amused by is the level of scepticism over an self contained eco-system. In order for any eco-system, either contained or not contained, there has to be much greater tolerances to extreme conditions that we generally acknowledge. In truth, outside of absolute extremes where organic life is simply impossible because or either denaturing or absolute destruction of organic material, life will exist. It's also entirely possible that this bottle now contains bacteria, fungi, or other organisms that are much more efficient at breaking down the organic material left by the dying plant mater.


The skepticism is entirely valid when the article in question is from the Daily Mail.


People really hate the daily mail, don't they? It's a tabloid, but realistically you should be skeptical about everything the press puts out. However, when it's a plant in a jar, being skeptical is really just being a crank. It's a plant in a jar. Who cares? Besides, just because more credible papers mention the guy doesn't change the fact that you have to take him for his word.

http://www.thetimes.co.uk/tto/science/biology/article3667780...


I think some people thrive on being contrarian, regardless of whether they have a valid reason for it or not. I just can't decide whether some people do it for the sake of appearing smart (look at me! I call everything into question!) or because they're extremely pessimistic and/or skeptical in nature. The problem with the latter is that it almost seems to be expressed in online discussions to a pathological extreme, so I'm sure it shares something with those personality traits that lend themselves to trolling (at least to a degree).

There's an interesting discussion on the bottled plant over at skeptics.stackexchange.com [1] that covers many of these reasons, but in more detail. The crux of it is that we can't really prove whether or not David Latimer did or did not water this plant in the 40-odd years since bottling it, so we're left with taking his word for it.

But at the end of the day I don't think it really matters. He looks like a nice guy I wouldn't mind having for a neighbor and really appreciates his plants. Maybe he's spinning a yarn, maybe he's not. Does it really matter? No.

[1] http://skeptics.stackexchange.com/questions/15838/can-a-plan...

Edit: Someone already linked this 5 hours ago (I should've ctrl+f'd it), so toss 'em some upvotes [2].

[2] https://news.ycombinator.com/item?id=7858522


I try to be rigorous in my thinking but I have also run into "skeptics" that are far too rigorous for daily life. My only complaint about this story is that it should be in the human interest section rather than the science section if it's too frivolous to subject to scrutiny.


The Daily Mail is especially hated because it's a tabloid hiding under a veneer of respectability. It has a long history of pandering 'science' stories.

This story for example. Don't you wonder how the interior of the glass has stayed so spotless for 40 years? It has to be cleaned, but they don't explain how.

Maybe it's some kind of magnetic cleaner, or maybe he's simply opening the bottle up to clean it. It's an obvious question, but it's typical of the Daily Mail's cynical and patronizing attitude that they don't care to answer it.


Cleaned from what exactly?

Post science not speculation.


From The New York Times Garden Book:

...clear glass encourages the growth of algae...

The bottle garden should be cleaned inside and out once a month.

Algae growth tends to be rapid in bottle gardens... This monthly scrubbing and cleaning out is the key to the whole success story.

Source: http://books.google.com/books?id=rSiFAAAAQBAJ&lpg=PT522&pg=P...

and: https://news.ycombinator.com/item?id=7858411


Just seen this - nice links.

It seems the story is indeed disingenuous. Thanks for posting.


It's not any old tabloid. It's journalistic ethos centres on garnering page views by stirring up fear and anger in its readers for the most part, with a bit of titilation from prepubescent girls on the side.


> now contains bacteria, fungi, or other organisms

Whichever types it contains now, surely it started out with :)


Not necessarily. The bacteria might have evolved inside the bottle.


I don't think it is unreasonable to assume some unique mutations in the bacteria? Depends I guess on what (if any) uv and other radiation gets through -- more perhaps than just the number of bacteria generations one would expect in 40 years...


Why can I not do this with my git commits? If you're trying to track down a blame on a security bug, this would be an amazing way to expose that.


Name a letter or a word and there is some project out there that had it before. If you come to grips with this now, your adult life will be much easier.


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: