Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Comment Re:Review Ruby for the perl enthusiast please (Score 2) 121

And every primitive has a class version...

Which emphasizes the point - they are different things, or the duplication wouldn't be necessary.

...to which the primitives are automatically boxed when they need to be treated like objects.

Auto-boxing/unboxing is an unbelievably ugly kludge which exists specifically because Java distinguishes between primitives and objects. After enough programmers kvetched about the ugliness and extra code that was needed, Sun threw auto-boxing in somewhere around Java 1.4 or 1.5.

Languages with a true "everything is an object" model don't need such an awful hack. They also don't require umpteen implementations of containers or sorting (one for Objects and one apiece for each of the primitive types), with all the library bloat that entails. They don't need the programmer to be mentally tracking which elements are primitives and which are objects, and making sure to use the right constructs for each.

Comment Re:Review Ruby for the perl enthusiast please (Score 4, Informative) 121

Java also sports the "everything is an object" mentality.

Say what?!?!?! Java explicitly distinguishes between primitives and objects! You can't send messages to primitives or literals in Java, only to objects and classes. Contrast with Ruby, where "5.times {p rand}" is a perfectly legitimate way to print five random numbers because the literal "5" is an Integer object which can respond to any message Integers implement.

Comment Re:Why perl? (Score 1) 263

A language in decline is dying. The data shows Ruby to be in a long decline, spanning several years. You're insane.

In an expanding market a given item can have a declining market share and still be experiencing growth. Apple sells more iPhones than ever even though its share of the smartphone market has declined. The same logic can apply to programming languages as well as commodities.

Comment Why perl? (Score 4, Interesting) 263

What can perl do that newer languages such as python and ruby can't do, and do more readably/maintainably?

I understand about path dependence and sunk costs, which is why we still have COBOL, I'm asking about language features that are unique to perl.

Comment Re:Interesting (Score 1) 513

For the birthday problem, this means 3*sqrt(365) or about 57 people in the room means 99 times out of 100 there's at least one duplicate birthday.

That was already answered further up.

So another poster clicked their submit button a minute or two before I did. Your comment seems rather gratuitous given that we were both trying to clarify things for you.

Also, you have to realize that there's actually 366 possible birthdays on leap years; people with a birthday of Feb 29th are a lot rarer than the others, but still exist.

Actually, the mathematically correct answer is a convex combination of the results for N=365 and N=366 with weightings 3/4 and 1/4, respectively. If you're going to pick a single number as representative of the answer, guess which one is closer? Besides which, all of this is premised on an assumption that birthdays are uniformly distributed throughout the year. That's close enough to get insight, but not actually true - there is a slight seasonality component in human birthrates.

You go from 366 possibilities to ~26k if you're looking for the year as well. You'd need 484 people to have a 99% chance of somebody being born on the same day and year as somebody else in the crowd.

You definitely lose the uniformity assumption by adding year - a larger proportion of the population are in their first couple of decades than in their 70's and 80's. As I mentioned earlier, non-uniformity actually increases the likelihood of duplicates so 484 should be an upper bound on the 99th percentile.

Comment Re:Interesting (Score 1) 513

If you have a pool of N possible outcomes, and outcomes are pretty uniformly distributed across the pool, the probability of a duplicate existing is around 0.99 by the time you sample 3*sqrt(N). For the birthday problem, this means 3*sqrt(365) or about 57 people in the room means 99 times out of 100 there's at least one duplicate birthday. For a hash table with a million storage locations, you can be pretty sure you'll see key duplication by the time you have added a mere 3000 elements to the table. That's why collision resolution schemes are necessary even in relatively sparse hash tables.

If outcomes aren't uniformly distributed, they bunch more in certain locations and the probability of getting duplicates goes up.

Comment Re:Vote (Score 4, Insightful) 707

I think you get where I am going... You talk about 4 general ideas, but when it comes to important real issues, there is no difference.

Actually, no, I don't know where you're going. I think the issues I mentioned are important and real. I also think that there are noteworthy policy differences between the two parties on several of the issues you raised. You may disagree with me about how big the differences are or which way many of those things should go, but to claim that there are no differences is ludicrous.

Comment Re:Vote (Score 5, Informative) 707

I beg to differ, it matters a great deal. The two major candidates have a lot of differences about how they'd handle the economy. Even more importantly, whichever side you come down on for issues such as "money == speech", "corporations are people", or Roe v. Wade, the long-term balance of the Supreme Court will very likely be decided by who gets elected.

Slashdot Top Deals

"Only the hypocrite is really rotten to the core." -- Hannah Arendt.

Working...