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 | » ]
Carson Gross

Posts: 153
Nickname: cgross
Registered: Oct, 2006

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 8:56 AM
Reply to this message Reply
Advertisement
> You didn't who 'we' are or what this language is called.
> Should I know these things already? How will I know when
> n it's been released in order to make fun of you? ;)

"We" are Guidewire, a company that makes insurance software, a programming language and some other things. Currently the language is called GScript, but we are going to rename it when we release it. I'll try to get something posted up here, and you can all rip it to shreds.

> Yes. This has got to be the way forward. Objects only
> exist at runtime and with everything running your IDE
> can inspect and probe as much as it likes.

What are the downsides of this approach?

Cheers,
Carson

Javier Diaz Soto

Posts: 29
Nickname: javierbds
Registered: Sep, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 10:23 AM
Reply to this message Reply
If ECMAScript is the answer, I do not want to know the question:

http://research.sun.com/techrep/2007/abstract-168.html
http://research.sun.com/techrep/2007/abstract-166.html
http://research.sun.com/techrep/2008/abstract-175.html

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 11:24 AM
Reply to this message Reply
> > > > Yes. This has got to be the way forward. Objects
> only
> > > > exist at runtime and with everything running your
> IDE
> > > can
> > > > inspect and probe as much as it likes.
> > >
> > > But even if it probes all it likes, how can it
> evaluate
> > > all possible paths of execution, especially if there
> is
> > > IO? I don't know smalltalk, but Python and Ruby
> allow
> > > statements to be created and evaluated at runtime
> just
> > as
> > > you can with reflection in Java. How can the IDE
> > 'know'
> > > what might happen?
> >
> > Hi James,
> >
> > Big subject, but the short answer is object memory. If
> > each object is in memory then you can send messages to
> it
> > and get answers. A lot of the answers you'll get back
> (in
> > response to reflection messages etc) are not available
> > from the static text at compile time.
>
> I understand that but how can 'object memory' predict what
> hasn't yet happened in an complex and modifiable
> application? I think maybe Turing proved that this is not
> possible a long time ago though I can't explain how I get
> from there to here off-the-cuff.

You are right. Smalltalk doesn't try to evaluate all paths of execution. No one is saying it does. What it does do however is give you an environment where you can inspect and probe your code whilst you are editing it. Think of it as a debugger on steroids.

People are crying out for the same functionality for Java (hot deploy etc), but Java is limited by class loader problems etc. No such problems in Smalltalk, a class is just another (factory) object in object memory. For example an exception doesn't give you a stack trace in Smalltalk. Instead you are presented with a Notifer window by default, telling you there has been an exception and asking whether you want to debug it. You can launch the debugger, track down the bug, fix the code, recompile (accept) the new method and continue execution.

And they came up with all this in the 1970's :)

You can also execute any snippet of code at any time just by selecting it and issuing a command (ctrl-d). The basic point is that with this level of rapid feedback static analysis is less important.

Paul.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 12:22 PM
Reply to this message Reply
> You are right. Smalltalk doesn't try to evaluate all paths
> of execution. No one is saying it does.

Well the claim was that SmallTalk can give you the same kind of information that static analysis can. In order for it to do so, it would have to be able to evaluate all possible execution paths. So, in a way, yeah, someone was making that claim.

The advantage of static typing is that it allows for this kind of analysis. The disadvantage is that in order for that to be the case, the kind of code that you can write is limited.

I once read another Steve Yegge blog about how many people use the "all Turing Complete languages are equivalent" argument with regard to static typing vs. dynamic typing. He makes a claim that this is true but that in a lot of cases, this means that you must write an interpreter in the static language to get the functionality of the dynamic language. In other words, you must implement a dynamic language in your static language. Assuming this is true, and it seem intuitively so to me, there is in fact no way to build certain classes of programs in a statically-analyzable way.

I think this is true and I believe that it's also true that these programs are useful. But this also means that languages that do support these types of programs cannot provide the kinds of features that a statically compiled language does. It's trade-off and there's no magic solution that will eliminate it.

Carson Gross

Posts: 153
Nickname: cgross
Registered: Oct, 2006

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 1:23 PM
Reply to this message Reply
> Well the claim was that SmallTalk can give you the same
> kind of information that static analysis can. In order
> for it to do so, it would have to be able to evaluate all
> possible execution paths. So, in a way, yeah, someone was
> making that claim.
>

++

These discussions seem to always veer off into "check out this *other* cool stuff smalltalk does" rather than staying focused on the code-completion (or refactoring, or code-navigation) problem. And that other stuff *is* cool, and the developers of java (and other statically typed languages) should strive for the more dynamic, incremental development loop of dynamic languages.

Since I don't work in one, I'd still like to hear what the downsides are to a constantly executing coding environment from someone who's worked on a team (>1 developer) using one. I've heard about the upsides.

Cheers,
Carson

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 2:43 PM
Reply to this message Reply
> > You are right. Smalltalk doesn't try to evaluate all
> paths
> > of execution. No one is saying it does.
>
> Well the claim was that SmallTalk can give you the same
> kind of information that static analysis can.

Really? Who by? I think the claim had to do with the usefulness of the IDE.
> In order
> for it to do so, it would have to be able to evaluate all
> possible execution paths. So, in a way, yeah, someone was
> making that claim.

I disagree. Static typing doesn't evaluate all execution paths either. If it did there wouldn't be a need for casts or runtime exceptions.
>
> The advantage of static typing is that it allows for this
> kind of analysis. The disadvantage is that in order for
> that to be the case, the kind of code that you can write
> is limited.

Static typing doesn't allow for the kind of analysis you speak of, but it does provide for "static type safety". This is not the same as "program correctness".
>
> I once read another Steve Yegge blog about how many people
> use the "all Turing Complete languages are equivalent"
> argument with regard to static typing vs. dynamic typing.
> He makes a claim that this is true but that in a lot of
> f cases, this means that you must write an interpreter in
> the static language to get the functionality of the
> dynamic language. In other words, you must implement a
> dynamic language in your static language.

Yeap. Which is why static programs are usually much longer then the dynamic equivalent.
> Assuming this
> is true, and it seem intuitively so to me, there is in
> fact no way to build certain classes of programs in a
> statically-analyzable way.

Bang on. This is the plain fact of the matter. You cannot verify an imperative program for correctness by using static analysis. To do this you need to program in a pure functional style with no state and no side effects.
>
> I think this is true and I believe that it's also true
> that these programs are useful. But this also means that
> languages that do support these types of programs cannot
> provide the kinds of features that a statically compiled
> language does.

This is incorrect. You can annotate a dynamic program with static types and check these statically.
> It's trade-off and there's no magic
> solution that will eliminate it.

You can have both. Dynamic at runtime and static at compile time. Strongtalk shows this is possible. The issue is that for a dynamic language the type system needs to be a lot more expressive to allow for the greater number of programs possible. Even then for an imperative program you still need to defer certain checks to runtime. Either that or restrict your dynamic language to what you can be sure is "type safe" at compile time (which I guess is on definition of a statically type safe language :)).

Paul.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 5:18 PM
Reply to this message Reply
> > > You are right. Smalltalk doesn't try to evaluate all
> > paths
> > > of execution. No one is saying it does.
> >
> > Well the claim was that SmallTalk can give you the same
> > kind of information that static analysis can.
>
> Really? Who by? I think the claim had to do with the
> usefulness of the IDE.

The post in question was by Todd Blanchard:


>Static typing enables deterministic refactoring, code analysis, code navigation, code completion, etc.

You know, I'm sick to death of this lie. Every Smalltalk I ever used had better code navigation, refactoring, and code completion tools than the best Java systems. And they had it first.

Enough with this myth. Its BS.


Note the term 'deterministic'.

> > In order
> > for it to do so, it would have to be able to evaluate
> all
> > possible execution paths. So, in a way, yeah, someone
> was
> > making that claim.
>
> I disagree. Static typing doesn't evaluate all execution
> paths either. If it did there wouldn't be a need for casts
> or runtime exceptions.

I didn't say that static typing evaluates all execution paths. Static typing allows certain kinds of provability in a program. Casts are needed when you step outside of the provability of the type system.

Please understand that this is not a opinion. I'm not saying what you get with static typing is worth the cost. I'm not saying static typing is good in this subthread. But these are factual statements I am making. There really isn't room for debate.

> >
> > The advantage of static typing is that it allows for
> this
> > kind of analysis. The disadvantage is that in order
> for
> > that to be the case, the kind of code that you can
> write
> > is limited.
>
> Static typing doesn't allow for the kind of analysis you
> speak of, but it does provide for "static type safety".
> This is not the same as "program correctness".

What kind of analysis in particular are you referring to. I have really only said that static typing allows for the kind of static typing that static analysis provides which is clearly a trivially true statement. Again, I haven't said that it's worth it. In fact I've stated that it's at least sometimes definitely not worth it.

> > I once read another Steve Yegge blog about how many
> people
> > use the "all Turing Complete languages are equivalent"
> > argument with regard to static typing vs. dynamic
> typing.
> > He makes a claim that this is true but that in a lot of
> > f cases, this means that you must write an interpreter
> in
> > the static language to get the functionality of the
> > dynamic language. In other words, you must implement a
> > dynamic language in your static language.
>
> Yeap. Which is why static programs are usually much longer
> then the dynamic equivalent.
> > Assuming this
> > is true, and it seem intuitively so to me, there is in
> > fact no way to build certain classes of programs in a
> > statically-analyzable way.
>
> Bang on. This is the plain fact of the matter. You cannot
> verify an imperative program for correctness by using
> static analysis. To do this you need to program in a pure
> functional style with no state and no side effects.

I guess it depends on how you define 'correctness' but I don't think there is any language that can prove a program is correct.

> > I think this is true and I believe that it's also true
> > that these programs are useful. But this also means
> that
> > languages that do support these types of programs
> cannot
> > provide the kinds of features that a statically
> compiled
> > language does.
>
> This is incorrect. You can annotate a dynamic program with
> static types and check these statically.

Look, I understand you are passionate about this and I respect that and I can say that you have personally contributed to my opening my eyes to the value of dynamic typing. But you can't have it both ways. You can't logically argue that we can write programs that are not statically analyzable and are statically analyzable.

> > It's trade-off and there's no magic
> > solution that will eliminate it.
> You can have both. Dynamic at runtime and static at
> compile time.

Just to be clear, 'dynamic language' really means something different that 'dynamically typed language'. The above could be construed as conflating the two. A give program (or portion thereof) is either fully statically typed or it is not. Deterministic static analysis cannot be achieved without full static typing. Casts are a perfect example of this. They cannot (in general) be proved to be safe by the compiler.

> Strongtalk shows this is possible. The issue
> is that for a dynamic language the type system needs to be
> a lot more expressive to allow for the greater number of
> programs possible. Even then for an imperative program
> you still need to defer certain checks to runtime. Either
> that or restrict your dynamic language to what you can be
> sure is "type safe" at compile time (which I guess is on
> definition of a statically type safe language :)).

Yes. The last sentence is the point. Static analysis allows for proving that certain parts of an application will not fail. Anywhere in your program where you step outside of this will not be provable in that way.

Again, I'm not saying that this in itself is a killer argument for static typing. The existence of casts demonstrates that it's often useful to step out of those bounds and being able to do even more unprovable things is very useful.

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 18, 2008 10:41 PM
Reply to this message Reply
Hi James,

The basic problem is that there is a lot of mis-communication when it comes to static typing. It is just a tool which some severe restrictions when it comes to imperative programming.

I have been very factual and precise. In truth there is no such thing as a statically type safe imperative program (even though we use the term all the time). There is such a thing as a statically type safe functional program (assuming you avoid things like I/O of course which are deemed impure actions:)).

The roots of static type systems in languages like C++ and Java have more to do with performance benefits then verifiable correctness. If you want provable code then don't use an imperative language.

Static typing in a language like Java does have real benefits. These revolve around documentation, tooling and quick feedback for trivial typing errors. The performance benefit no longer exists because the same performance can be achieved other ways. It also has draw backs such as a restrictive programming model, which is Steves point and why the Scala static type system is more expressive (and more complex).

Terms like type safety have been banded around so much that they have become meaningless.

When you check the small print, static typing in Java provides very few guarantees at all. If you want provable guarantees then use Haskell.

Paul.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 6:23 AM
Reply to this message Reply
> Hi James,
>
> The basic problem is that there is a lot of
> mis-communication when it comes to static typing. It is
> just a tool which some severe restrictions when it comes
> to imperative programming.
>
> I have been very factual and precise. In truth there is no
> such thing as a statically type safe imperative program
> (even though we use the term all the time).

I have a hard time believing this. I believe I can write such a program in Java even though it's type system is fairly weak. I can show you a trivial imperative program that is perfectly type safe if you need proof.

> When you check the small print, static typing in Java
> provides very few guarantees at all. If you want provable
> guarantees then use Haskell.

I'm not arguing that a language like Haskell doesn't have more probable guarantees and that it's functional nature is part of what makes that possible. The point I was making is that static typing allows for static analysis and static analysis allows for certain types of features to be implemented deterministically. Dynamic languages that cannot be statically analyzed cannot offer these features in a deterministic manner. There's no way around it. Please not that I haven't said what these features are and that I haven't said that Java allows for perfectly type safe program or even that I think Java is a good language. All of that is orthogonal to my point.

Nemanja Trifunovic

Posts: 172
Nickname: ntrif
Registered: Jun, 2004

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 8:01 AM
Reply to this message Reply
> The performance
> benefit no longer exists because the same performance can
> be achieved other ways.

Which ways? Or even better, is there a dynamic language that can perform as well as Fortran/C/C++/D or say Java/C# or maybe ML/Haskell?

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 8:02 AM
Reply to this message Reply
> > Hi James,
> >
> > The basic problem is that there is a lot of
> > mis-communication when it comes to static typing. It is
> > just a tool which some severe restrictions when it
> comes
> > to imperative programming.
> >
> > I have been very factual and precise. In truth there is
> no
> > such thing as a statically type safe imperative program
> > (even though we use the term all the time).
>
> I have a hard time believing this. I believe I can write
> such a program in Java even though it's type system is
> fairly weak. I can show you a trivial imperative program
> that is perfectly type safe if you need proof.

OK. Let me be more specific. You can right a type safe program in a static language. You can also write a type safe program in a dynamic language. The fact that your program compiles does not verify that it is type safe in either.
>
> > When you check the small print, static typing in Java
> > provides very few guarantees at all. If you want
> provable
> > guarantees then use Haskell.
>
> I'm not arguing that a language like Haskell doesn't have
> more probable guarantees and that it's functional nature
> is part of what makes that possible. The point I was
> making is that static typing allows for static analysis
> and static analysis allows for certain types of features
> to be implemented deterministically. Dynamic languages
> that cannot be statically analyzed cannot offer these
> features in a deterministic manner. There's no way around
> it. Please not that I haven't said what these features
> are and that I haven't said that Java allows for perfectly
> type safe program or even that I think Java is a good
> language. All of that is orthogonal to my point.

It is not a matter of good or bad it is a matter of being precise in our language. Static type safety as a marketing slogan is a very different thing then static type safety as a computer science concept. Java is only partially statically type safe.

We need to define our terms:

http://c2.com/cgi/wiki?TypeSafe

As I said partial static type safety provides very few gurantees. The fact that a Java program compiles doesn't mean that it is type safe, hence NullPointerException, TypeCastException ... etc.

Paul.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 8:55 AM
Reply to this message Reply
> OK. Let me be more specific. You can right a type safe
> program in a static language. You can also write a type
> safe program in a dynamic language. The fact that your
> program compiles does not verify that it is type safe in
> either.

If your compiler guarantees type-safety then the compiler does guarantees type-safety. That is a tautology.

> It is not a matter of good or bad it is a matter of being
> precise in our language. Static type safety as a marketing
> slogan is a very different thing then static type safety
> as a computer science concept. Java is only partially
> statically type safe.
>
> We need to define our terms:
>
> http://c2.com/cgi/wiki?TypeSafe

From that page and the definition I have been using all along:

"Any variable with a declared type will always reference an object of either that type or a subtype of that type."

Note the term 'correctness' is not mentioned.

> As I said partial static type safety provides very few
> gurantees. The fact that a Java program compiles doesn't
> mean that it is type safe, hence NullPointerException,
> TypeCastException ... etc.

As I said before, any time you add explicit casts to your code you are stepping outside of static typing. If you don't step out of the type system you are guaranteed to not have type cast exceptions. A NullPointerException doesn't necessarily imply that type safety has been violated. In Java, nulls are a valid value for any Object type. That is, they are a child of every type.

This might seem like an arbitrary cop-out and it pretty much is but technically, NPEs are not related to type-safety. Now, if the language doesn't make this special allowance for nulls, then you wouldn't be able to have NPEs if you remain type-safe.

Morgan Conrad

Posts: 307
Nickname: miata71
Registered: Mar, 2006

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 9:31 AM
Reply to this message Reply
Paul, you are setting an impossible target for perfect correctness. A functional program with no I/O is provably correct, and, in most cases, useless. The perfect is the enemy of the good.

In the real world, we live with imperfect systems. Staticly typed languages give some control over those imperfections. Or at least the illusion of control. Just like dynamic languages give the illusion of higher productivity.

But the rate limiting step in productivity is definitly NOT typing. Anybody seriously complaining about lower productivity due to having to type

SuperDuperObject mySuperDuperObject

instead of

var mySuperDuperObject

has zero credibility. Zero.


The problem is bad programmers and bad styles. I'm sure that the same people who write the bad Java code that Yegge mocked in Kingdom of the Nouns can write just as wretched code in Smalltalk or Haskell.

Paul Beckford

Posts: 51
Nickname: phaedrus
Registered: Feb, 2007

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 9:58 AM
Reply to this message Reply
> Paul, you are setting an impossible target for perfect
> correctness. A functional program with no I/O is
> provably correct, and, in most cases, useless. The
> perfect is the enemy of the good.
>
> In the real world, we live with imperfect systems.
> Staticly typed languages give some control over those
> e imperfections. Or at least the illusion of control.
> Just like dynamic languages give the illusion of higher
> r productivity.
>
> But the rate limiting step in productivity is definitly
> NOT typing. Anybody seriously complaining about lower
> productivity due to having to type
>
> SuperDuperObject mySuperDuperObject
>
> instead of
>
> var mySuperDuperObject
>
> has zero credibility. Zero.
>
>
> The problem is bad programmers and bad styles. I'm sure
> that the same people who write the bad Java code that
> Yegge mocked in Kingdom of the Nouns can write just as
> wretched code in Smalltalk or Haskell.

Morgan,

You and I are in violent agreement LOL!!!

I am merely exposing the nonsense of the "static type safe" marketing speil.

At the end of the
day it all comes down to programmers. Functional programming has its benefits when it comes to concurrent computation, but at the end of the day correctness still comes down to the programmer.

So why the big debate? If we spent a fraction of the time getting good at creating robust executable design specifications (tests) as advocated by BDD/TDD we would be in a much better position to verify whether our programs are correct or not. The idea that you can achieve this by merely running a compiler over your code is laughable.

There is no safety which is why most projects spend so much time fixing bugs. The idea of static safety is an illusion.

Any objective observer would recognise this as evidently true :)

Paul.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Steve Yegge on Rhinos and Tigers Posted: Jun 19, 2008 10:16 AM
Reply to this message Reply
> There is no safety which is why most projects spend so
> much time fixing bugs. The idea of static safety is an
> illusion.

This seems like a strawman to me. I didn't see anyone make any claim that type safety ensures your code is correct. Moreover, I don't know any developers that think that static typing ensures their code will work. The only people that I know of that even care about this are Haskell nerds and I think you'd be hard pressed to find someone outside of academia using Haskell for 'real' work.

Static typing in the real world just creates some limits on the kinds of things that can go wrong. It narrows down the kinds of things that are possible and this makes things more manageable. It also limits the kinds of approaches that can be used. The real debate is whether the benefits are worth the cost.

Flat View: This topic has 66 replies on 5 pages [ « | 1  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