News for hackers. Stuff that matters.
Re:C++ at Google: Here Be Dragons by timr on Monday May 23, 2011 @06:28PM (#2577847)
To me, the most remarkable thing about this post is that when the rest of the world is falling in love with the "power" of weak typing systems, Google is going the other way.
Re:C++ at Google: Here Be Dragons by obiterdictum on Monday May 23, 2011 @08:03PM (#2578117)
I think this is a very web-development-centric view on things. In fact, I dare suggest that the world does not revolve around JS, and the bulk of development, especially in-house, is done in fairly pedestrian languages (C++, Java, C#). Web developers tend to have more web presence, naturally, so the majority of public discussions and news may make it seem to be representative of the world.
Re:C++ at Google: Here Be Dragons by profquail on Monday May 23, 2011 @06:43PM (#2577888)
the rest of the world is falling in love with the "power" of weak typing systems

Really? I'd argue the exact opposite -- with F# and Scala (and some others) on the rise, I think there are plenty of people who are fed up with weak/dynamic typing and want to take advantage of building programs with strong type systems.

At the very least, it seems that the programming world is becoming much more polarized. Anecdotally, it seems that every developer I know is either a proponent of strong/static typing or weak/dynamic typing -- but I don't know anyone that's just sitting on the fence.

Re:C++ at Google: Here Be Dragons by cageface on Monday May 23, 2011 @08:04PM (#2578120)
I'm certainly going the other way. After working almost exclusively in dynamic languages for almost 10 years I'm finding it enormously refreshing to have the help of the compiler again when I'm writing Scala code. Even the primitive type system of Objective-C is a welcome change. Of course, occasionally you need an escape hatch. But, in my experiences, the good static languages give you enough wiggle room to do this when you really need to.
Re:C++ at Google: Here Be Dragons by undees on Monday May 23, 2011 @07:00PM (#2577935)
The term "strong" appears overloaded here. A language can be dynamically typed, but still have strong typing (in the sense that the language, whether at compile time or runtime, enforces what operations are allowed on a particular value).
Re:C++ at Google: Here Be Dragons by daniel-cussen on Monday May 23, 2011 @07:44PM (#2578059)
This is true. Lisp compiles beautifully if you put the work into making it do so, and this work can be automated with macros.
Re:C++ at Google: Here Be Dragons by swannodette on Monday May 23, 2011 @07:42PM (#2578051)
Those in favor of only static typing and those in favor of only dynamic typing are living in the past. Any interesting evolution in programming languages will allow developers to program with and without types / contracts from the same language.
Re:C++ at Google: Here Be Dragons by olavk on Tuesday May 24, 2011 @06:11AM (#2579299)
In Mascara (my own project) you can start out with dynamically typed JavaScript, but then gradually add type annotation as appropriate to provide stronger verification. It can be done using structural types without changing the runtime semantics, and further by rewriting to use classes and nominal typing.

I think this provides a useful upgrade path, because type verification is a hassle with small projects, but becomes increasingly valuable (IMHO) as the program grows.

The problem with current languages is that you have to decide upfront if you want a language optimized for quick development or strong verification. But often in the real world, programs start out as quick prototypes, and then grow into large applications.

Re:C++ at Google: Here Be Dragons by jorgeortiz85 on Monday May 23, 2011 @07:49PM (#2578068)
C#'s new "dynamic" type and Scala's new Dynamic trait are a step in that direction.
Re:C++ at Google: Here Be Dragons by jazzyb on Tuesday May 24, 2011 @10:52AM (#2580027)
Qi is a lisp-like language with Haskell-style type-checking which can be turned on and off at will:

http://en.wikipedia.org/wiki/Qi_(programming_language)#Type_...

Re:C++ at Google: Here Be Dragons by michaelcampbell on Monday May 23, 2011 @07:20PM (#2577994)
I'm a fence-sitter, but as you note, it's unlikely you know me. I do find that I'm starting to lean more on the strong/static side lately, but that might be because professionally I write financial institution software which tends to be big, and I want as much checked as early and as thoroughly as possible.

For fun hobby stuff, I love dynamic languages where I can produce quite a bit of functionality in a very short (if dangerous) time and rely on a set of tests to keep it all managed.

Re:C++ at Google: Here Be Dragons by regularfry on Tuesday May 24, 2011 @08:11AM (#2579495)
After a few years of fence-sitting doing a lot of ruby, I find myself... still sitting on the fence. My next project will probably be in erlang and haskell, for what it's worth.
Re:C++ at Google: Here Be Dragons by michaelcampbell on Monday May 23, 2011 @07:18PM (#2577987)
I hear you, but I think the rest of the world is actually polarizing to some degree. Perhaps I'm just fickle or a language whore, but I love both the dynamism and freedom of Ruby (et. al.) and the "protect me from doing stupid $#@!" of Scala (et. al.) Although honestly, I don't know that I'd want a language that supported both, if even such a thing were possible.

I do see a lot of people getting all hung up on one side or the other though; and it could be that the rest of the world you are seeing is just that group "over there".

Perhaps predictably, as I get older (in my 40's now), I am leaning more towards the strong type system languages, but I do enjoy my dalliances with a dynamic language, at least for small things.

Re:C++ at Google: Here Be Dragons by nradov on Monday May 23, 2011 @07:38PM (#2578039)
Why can't we have a language that supports both? I would love to have a language with a scalable type system where I could hack out a quick small prototype with dynamic typing first, and then perhaps layer on static types later where necessary to improve reliability and performance as the program evolves. For example, I would like to be able to declare a variable in all of the following different ways.

a value

a number

a rational number

a rational number between [0.0 - 1.0)

a rational number between [0.0 - 1.0), and I don't need any more than 30 bits of precision

a rational number between [0.0 - 1.0), and I don't need any more than 30 bits of precision, and please try to optimize for minimum memory usage instead of performance

Re:C++ at Google: Here Be Dragons by swannodette on Monday May 23, 2011 @07:46PM (#2578065)
You can support both. You should take look at Typed Racket, Racket w/ Contracts, Erlang Dialyzer, and Qi/Shen. Frankly the Lisp contingent is way ahead on this kind of thinking (would of course love to hear about others).

I'm interested in developing such systems for Clojure and have actively researching something considerably more powerful than Chambers/Chen predicate dispatch.

Re:C++ at Google: Here Be Dragons by Confusion on Tuesday May 24, 2011 @03:43AM (#2579031)
Qi/Shen is a fusion of Haskell and Lisp, heavily inspired by Haskell. The Lisp contingent is not 'way ahead': they are simply assimilating useful bits of their strongly typed functional cousin languages.
Re:C++ at Google: Here Be Dragons by anamax on Monday May 23, 2011 @11:46PM (#2578574)
> a rational number

> a rational number between [0.0 - 1.0)

Those are representation errors.

The hard problems that I run into rarely have much to do with representation. The hard problems are knowing when it's okay to add apples and oranges and when it isn't.

Re:C++ at Google: Here Be Dragons by michaelcampbell on Monday May 23, 2011 @09:17PM (#2578275)
I'm not experienced enough to say that you absolutely can, or cannot. I only have some experience to guide me, and I haven't seen it done yet.

That said..., I have an uneasy feeling that trying to do it would end up with a PL/1 type of situation where, depending on your background, you write it with whatever baggage you bring with you, and the language would get large to the point of different types of programmers writing in their own familiar subset of the language.

Or, I'm completely wrong. =)

Re:C++ at Google: Here Be Dragons by zoul on Tuesday May 24, 2011 @06:34AM (#2579339)
You might be interested in the type system of Perl 6:

    subset Filename of Str where { $_ ~~ :f };
Here you define the Filename type as a string that represents an existing path. This particular example is a horrendous hack of course, but the tool looks very interesting. Not sure if this can be used for performance tuning in existing P6 implementations.
Re:C++ at Google: Here Be Dragons by rjh29 on Tuesday May 24, 2011 @07:01AM (#2579389)
That's a horrible hack indeed :)

Perl 6 does have 'gradual typing' though. You can define a variant:

  my $foo;
or a typed variable:

  my Int $foo;
or a subtype with arbitrary restrictions

  subset OneToTen of Int where { 1 <= $^n <= 10 };
  my OneToTen $foo;
Or... (http://rosettacode.org/wiki/Define_a_primitive_data_type#Per...)

  subset Prime of Int where { $^n > 1 and $^n %% none 2 .. sqrt $^n };
Perl 6 scares me.
Re:C++ at Google: Here Be Dragons by edabobojr on Tuesday May 24, 2011 @11:25AM (#2580175)
It's been a long time, but I believe Ada provides the ability for the first 4 and I would bet you could define the last two in it.
Re:C++ at Google: Here Be Dragons by lurker19 on Monday May 23, 2011 @11:34PM (#2578551)
Hrm? That blog post is all about Google is using Clang to dig themselves out of a hole they fell into by using C++ with its weak type system, and doesn't suggest they have plans to change languages.
Re:C++ at Google: Here Be Dragons by SoftwareMaven on Tuesday May 24, 2011 @01:30AM (#2578803)
I think the Go* language is proof they are trying to solve some of C++'s problems without giving up speed.

It would be an amazing research project to take a couple different, large Google C++ programs and port them to Haskel and Erlang to see how they compre.

* Why does it have to be such a common word for it's name? Just means it's name, for all practical purposes, is "Go Language".

Re:C++ at Google: Here Be Dragons by lolcraft on Tuesday May 24, 2011 @09:26AM (#2579686)
C++'s typing is fairly weak. Most of the errors shown in the article were weaknesses of the type system. Now Haskell, or even Java...