The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Steve Yegge on Rhinos and Tigers

66 replies on 5 pages. Most recent reply: Jul 12, 2008 10:14 PM by Gregor Zeitlinger

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 66 replies on 5 pages [ « | 1 ... 2 3 4 5 ]
Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 27, 2008 6:20 AM
Reply to this message Reply
Advertisement
> Hi Paul,
>
> A favorite paper of mine.
>
> If you read Meijer carefully, you'll find that he
> advocates *static typing* with use of type inference to
> avoid the verbosity and heavy type system engagement
> currently foisted on programmers by most static languages
> (e.g. Java). I don't think he's asking for a language with
> both static and dynamic typing in the manner of Ecma 4.
> He's more or less stating he wants static typing where the
> compiler infers types whenever possible.
Yes. He also mentions scenarios where the compiler just doesn't know. In some languages such scenarios are deemed "unsafe" by default and you are forced to code around the compiler even though you know that what you wanted to express is perfectly safe. Instead in scenarios where the compiler cannot know sif the code is safe statically you could choose to defer type checking to runtime where the runtime will know and can make an accurate choice to trap a true error if required. This is the "dynamic typing when needed" bit, and Eric uses the way Arrays and invariance works in Java as an example. If they had taken the same approach with generic collectons we would not have the horrible use site declarations and type bounds we have now.
>
> Re:
> > I believe we will better educate programmers once we
> > drop the fallacy that we can rely on tools.
>
> Well, that's a rather bold statement. I'm part of a team
> that would utterly collapse without tools. Tools that
> depend on a static type system. Extremely useful tools
> that cannot exist without a static type system. If you've
> ever used IntelliJ IDEA on a large project, you'd know the
> class of tools I'm referring to. In fact I just finished a
> semi-large task of extracting an abstract API to decouple
> a module so that its implementation is not available at
> compile time, only the API is exposed. This involved a
> storm of refactoring, code navigation, code completion,
> etc. I can't imagine having to do that without tools.

I didn't say we don't need tools, what I said is that tools cannot infer whether your code is safe. They never will.
>
> Man has limitations. We can't keep large software systems
> in our heads. Time spent fumbling about in a codebase is
> not time well spent. It turns out computers are much
> better at remembering where things are, what references
> what, what has what, and the like. Computers are even
> better and faster at making changes based on this
> information. Ultimately, tools that save us from our
> limitations are a good thing. If static typing helps in
> this regard, then why not leverage it to the best of our
> ability? As Meijer states in his paper, we certainly have
> room for improvement.

Again I think you are choosing to hear only half the message. Tools help with somethings (like traping certain kinds of programming errors early), but writing safe code isn't one of them. Programmers write safe code.

This is self evident.

Paul.

Fred Garvin

Posts: 52
Nickname: fredgarvin
Registered: Jan, 2008

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 27, 2008 10:35 AM
Reply to this message Reply
> > Hi Paul,
> >
> > A favorite paper of mine.
> >
> > If you read Meijer carefully, you'll find that he
> > advocates *static typing* with use of type inference to
> > avoid the verbosity and heavy type system engagement
> > currently foisted on programmers by most static
> languages
> > (e.g. Java). I don't think he's asking for a language
> with
> > both static and dynamic typing in the manner of Ecma 4.
> > He's more or less stating he wants static typing where
> the
> > compiler infers types whenever possible.
> Yes. He also mentions scenarios where the compiler just
> doesn't know. In some languages such scenarios are deemed
> "unsafe" by default and you are forced to code around the
> compiler even though you know that what you wanted to
> express is perfectly safe. Instead in scenarios where the
> compiler cannot know sif the code is safe statically you
> could choose to defer type checking to runtime where the
> runtime will know and can make an accurate choice to trap
> a true error if required. This is the "dynamic typing when
> needed" bit, and Eric uses the way Arrays and invariance
> works in Java as an example. If they had taken the same
> approach with generic collectons we would not have the
> horrible use site declarations and type bounds we have
> now.

Methinks you are misreading/misunderstanding what he wrote. He never mentions use of dynamic types proper, only inferred types -- big, big difference. Regarding the array example, we're still in the realm of static types; albeit the covariance on the array does have issues. That's a trade-off he is will to make in order for generics to be more practical. It has nothing to do with dynamic types. In effect Meijer is acknowledging that a sound type system is not always practical or achievable and that usefulness trumps "safety". I think this is perhaps where you are misunderstanding his idea.

> >
> > Re:
> > > I believe we will better educate programmers once we
> > > drop the fallacy that we can rely on tools.
> >
> > Well, that's a rather bold statement. I'm part of a team
> > that would utterly collapse without tools. Tools that
> > depend on a static type system. Extremely useful tools
> > that cannot exist without a static type system. If you've
> > ever used IntelliJ IDEA on a large project, you'd know
> the
> > class of tools I'm referring to. In fact I just finished
> a
> > semi-large task of extracting an abstract API to
> decouple
> > a module so that its implementation is not available at
> > compile time, only the API is exposed. This involved a
> > storm of refactoring, code navigation, code completion,
> > etc. I can't imagine having to do that without tools.
>
> I didn't say we don't need tools, what I said is that
> tools cannot infer whether your code is safe. They never
> will.
> >
> > Man has limitations. We can't keep large software
> systems
> > in our heads. Time spent fumbling about in a codebase
> is
> > not time well spent. It turns out computers are much
> > better at remembering where things are, what references
> > what, what has what, and the like. Computers are even
> > better and faster at making changes based on this
> > information. Ultimately, tools that save us from our
> > limitations are a good thing. If static typing helps in
> > this regard, then why not leverage it to the best of
> our
> > ability? As Meijer states in his paper, we certainly
> have
> > room for improvement.
>
> Again I think you are choosing to hear only half the
> message. Tools help with somethings (like traping certain
> kinds of programming errors early), but writing safe code
> isn't one of them. Programmers write safe code.
>
> This is self evident.
>

"Safe" code? "Self evident"? Interesting.

To what degree can you "rely" on your ability to refactor code on a large project without proper tools? How long would it take you? How "safe" would the code be? After all, you refactored your tests too; are you sure those tests can be relied upon after your refactor? And, again, how time consuming would the task be? With a dynamic language you don't have proper tools. Not today, not ever. Not unless you are using the fabled smalltalk environment that does everything IDEA does. Static languages have a clear advantage wrt solid, *deterministic* tools.

John Zabroski

Posts: 272
Nickname: zbo
Registered: Jan, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 27, 2008 12:12 PM
Reply to this message Reply
> The best options I've seen so far are:

> 1. Go pure functional and use something like Haskell.
> 2. Use a more expressive static type system like Scala.
> 3. Use a pluggable type system as an optional tool where it helps.

Hmm...

> 4. Focus on program correctness instead of type safety and rely on TDD/BDD instead.

What about Model-Driven Software Development?

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 27, 2008 1:19 PM
Reply to this message Reply
> > > Hi Paul,
> > >
> > > A favorite paper of mine.
> > >
> > > If you read Meijer carefully, you'll find that he
> > > advocates *static typing* with use of type inference
> to
> > > avoid the verbosity and heavy type system engagement
> > > currently foisted on programmers by most static
> > languages
> > > (e.g. Java). I don't think he's asking for a language
> > with
> > > both static and dynamic typing in the manner of Ecma
> 4.
> > > He's more or less stating he wants static typing
> where
> > the
> > > compiler infers types whenever possible.
> > Yes. He also mentions scenarios where the compiler just
> > doesn't know. In some languages such scenarios are
> deemed
> > "unsafe" by default and you are forced to code around
> the
> > compiler even though you know that what you wanted to
> > express is perfectly safe. Instead in scenarios where
> the
> > compiler cannot know sif the code is safe statically
> you
> > could choose to defer type checking to runtime where
> the
> > runtime will know and can make an accurate choice to
> trap
> > a true error if required. This is the "dynamic typing
> when
> > needed" bit, and Eric uses the way Arrays and
> invariance
> > works in Java as an example. If they had taken the same
> > approach with generic collectons we would not have the
> > horrible use site declarations and type bounds we have
> > now.
>
> Methinks you are misreading/misunderstanding what he
> wrote. He never mentions use of dynamic types proper, only
> inferred types -- big, big difference. Regarding the array
> example, we're still in the realm of static types; albeit
> the covariance on the array does have issues. That's a
> trade-off he is will to make in order for generics to be
> more practical. It has nothing to do with dynamic types.
>

The language performs a dynamic type check at runtime. The title of the paper is "Static typing when possible dynamic typing when needed". Now how you choose to interpret "possible" and "neeeded" is open to debate, but the fact that Eric is advocating both approaches together isn't.
> > >
> > > Re:
> > > > I believe we will better educate programmers once we
>
> > > > drop the fallacy that we can rely on tools.
> > >
> > > Well, that's a rather bold statement. I'm part of a
> team
> > > that would utterly collapse without tools. Tools that
> > > depend on a static type system. Extremely useful
> tools
> > > that cannot exist without a static type system. If
> you've
> > > ever used IntelliJ IDEA on a large project, you'd
> know
> > the
> > > class of tools I'm referring to. In fact I just
> finished
> > a
> > > semi-large task of extracting an abstract API to
> > decouple
> > > a module so that its implementation is not available
> at
> > > compile time, only the API is exposed. This involved
> a
> > > storm of refactoring, code navigation, code
> completion,
> > > etc. I can't imagine having to do that without tools.
>
> >
> > I didn't say we don't need tools, what I said is that
> > tools cannot infer whether your code is safe. They
> never
> > will.
> > >
> > > Man has limitations. We can't keep large software
> > systems
> > > in our heads. Time spent fumbling about in a codebase
> > is
> > > not time well spent. It turns out computers are much
> > > better at remembering where things are, what
> references
> > > what, what has what, and the like. Computers are even
> > > better and faster at making changes based on this
> > > information. Ultimately, tools that save us from our
> > > limitations are a good thing. If static typing helps
> in
> > > this regard, then why not leverage it to the best of
> > our
> > > ability? As Meijer states in his paper, we certainly
> > have
> > > room for improvement.
> >
> > Again I think you are choosing to hear only half the
> > message. Tools help with somethings (like traping
> certain
> > kinds of programming errors early), but writing safe
> code
> > isn't one of them. Programmers write safe code.
> >
> > This is self evident.
> >
>
> "Safe" code? "Self evident"? Interesting.
>
> To what degree can you "rely" on your ability to refactor
> code on a large project without proper tools?

I don't rely on tools I rely on my tests (or executable design specifications as I prefer to call them).

>How long
> would it take you? How "safe" would the code be? After
> all, you refactored your tests too; are you sure those
> tests can be relied upon after your refactor? And, again,
> how time consuming would the task be? With a dynamic
> language you don't have proper tools.

Wow thats a bold statement. Would you like to back it up?
> Not today, not ever.
> Not unless you are using the fabled smalltalk environment
> that does everything IDEA does. Static languages have a
> clear advantage wrt solid, *deterministic* tools.

IDEA maintains an in memory image of your code, and idea it took from Smalltalk. If you check my earlier posts I have already said that static languages have some benefits including tooling. What I am also said is that static laguages also have certain limitations and draw backs. A fact that you seem to be blind to.

What I said in the post you responded to is that tools do not produce safe programs, good programmers do. Dwell on this a bit before responding and you will realise that it is unrefutable.

Regards,

Paul.

Fred Garvin

Posts: 52
Nickname: fredgarvin
Registered: Jan, 2008

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 28, 2008 6:29 PM
Reply to this message Reply
> IDEA maintains an in memory image of your code, and idea
> it took from Smalltalk.

That's just not true. IDEA maintains an indexed database of types, type members, references to types, and references to type members. It can do this only because Java is a static language. The Smalltalk IDE had to *run* all your code and make a lot of guesses.

Regarding your other remarks, all I can say is that I *do* have an open mind. If you read my comments with an open mind it's pretty clear that I see benefits of both static and dynamic type systems e.g., reread my initial remark to this article. The trouble is most people take sides and don't want to consider combining concepts of both. I believe that a static type foundation with type inference and good grammar are key.

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 28, 2008 11:56 PM
Reply to this message Reply
> > IDEA maintains an in memory image of your code, and idea
>
> > it took from Smalltalk.
>
> That's just not true. IDEA maintains an indexed database
> of types, type members, references to types, and
> references to type members. It can do this only because
> Java is a static language. The Smalltalk IDE had to *run*
> all your code and make a lot of guesses.
>
> Regarding your other remarks, all I can say is that I *do*
> have an open mind. If you read my comments with an open
> mind it's pretty clear that I see benefits of both static
> and dynamic type systems e.g., reread my initial remark to
> this article. The trouble is most people take sides and
> don't want to consider combining concepts of both. I
> believe that a static type foundation with type inference
> and good grammar are key.

Hi Fred,

I understand your preference and I respect your choices. This doesn't change the facts though. So called "typer safe" languages like Java and C# are not type safe. They also use a mix of static type checking and dynamic type checking and always have. The real issue here with these languages is performance and compiler optimisation not safety. The other benefits of static typing (documentation, tooling etc) can be achieved by adding manifest type annotation or using type inference with a dynamic language whilst retaining true dynamic dispatch (message sending) with all the benefits that follow.

As for InteliJ I am not 100% sure, but Eclipse was derived form VisualAge for Smalltalk/Java at IBM and definitely creates an image, borrowing the incremental compilation and development idea from Smalltalk. I assumed that InteliJ does the same. An image provides a lot more information about a program than you may think, even without static types (an without running the code). I agree static types (either manifest or inferred) provides even more information to the IDE. I believe Squeak uses type inference at compile time but I'm not sure (it is definitely possible in Smalltalk). I know for sure that Strongtalk uses both manifest types and type inference. So it is not black or white :)

The good news is you can have both (static analysis and dynamic dispatch) and new languages like Newspeak will show whats possible once you move beyond the vtable as an optimisation technique. There are better ways to maintain performance and they have been around for years now :)

Paul.

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jul 12, 2008 10:14 PM
Reply to this message Reply
> Yeah but assuming that C#3's type inference is similar to
> Scala's there is a significant difference when it comes
> the type returned by a method. Scala requires this be
> declared. I don't know that there's anyway to avoid this,
> at least not for abstract methods.
No, C# type inference (the var keyword) is limited to local variables that assigned immediately - a good design choice, I think.

> > I also find being able to delete a method and run a
> > relatively fast compile (versus a ten minute test
> suite)
> > to see what's broken pretty useful.
>
> This, plus reliable automated refactoring and just
> changing something and seeing where the red spots appear
> are the benefits to me.
The 'find usage' (IntelliJ IDEA)/'show call history' (Eclipse) is much, much more important to me. It's the best way to get familiarized with foreign code - or code that I wrote a year ago...

> I've been thinking that it would be nice to create a
> language (let's call it Simple) that takes the basic
> syntax of Java, removes the mistakes and limits the
> verbosity, adds a few killer features from other languages
> and be done. Maybe someone else has done it already but I
> haven't seen it.
C# 3.0 fits this pretty much already.
There are a couple of things I miss there:
1) mix-ins or traits
2) resumable exceptions
3) method literals
4) default covariance for generics (maybe Scala style generics (definition site variance declaration) instead)
5) being able to specify static methods in interfaces (Java example: make String.class.toUpper() type safe)
6) Null/NotNull (all types are non-null, except String? myBeNull = null)

Flat View: This topic has 66 replies on 5 pages [ « | 2  3  4  5 ]
Topic: Steve Yegge on Rhinos and Tigers Previous Topic   Next Topic Topic: Sun Releases JDK 6 Update 7 with VisualVM

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use