The Artima Developer Community
Sponsored Link

Weblogs Forum
What's up with Diggins?

36 replies on 3 pages. Most recent reply: Jan 18, 2006 10:50 PM by Robert Parnell

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 36 replies on 3 pages [ « | 1 2 3 ]
Kresimir Cosic

Posts: 34
Nickname: kreso1
Registered: Jan, 2006

Re: What's up with Diggins? Posted: Jan 18, 2006 7:23 AM
Reply to this message Reply
Advertisement
@Gregor Zeitlinger

> Yes, I just realized that I got that part wrong. I had thought that this would not be
> possible, because I was thinking at how duck typing is implemented in Java.
>Now that I see it in this light, my first concern is less of an issue, too. Even if you
> don't have the implements clause, the IDE can show you all traits that a given class
> participates in.

No, IDE can't do that. That's because IDE can rely only on structural subtyping part, not behavioral subtyping. This would cause IDE to report some extra traits that a given class does not participate in.

Also note that this "participate in" relation is (almost) transitive… if class C1 "participates in" trait T2, and trait T2 "participates in" trait T3, then C1 might "participate in" T3. The reason I'm putting this up is that I think that this problem grows very fast as the number of classes and traits grow, and could render this IDE feature useless. And it would pose a great problem to humans, too. So you need that "nominal" and "implements" keywords.

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: What's up with Diggins? Posted: Jan 18, 2006 7:28 AM
Reply to this message Reply
> > In my experience, with C++, using the right libraries,
> you
> > can get any level of abstraction as you like.
>
> This is not true. C++ doesn't have the right mechanisms to
> do abstraction properly.

As a generalization, I do not believe this to be true. Many of my articles and blog entries, have been an attempt to show just what you can do with C++. You can implement garbage collectuib, functional languages, dynamic typing, structural subtyping, declarative languages, concurrent code, programming with contracts, etc. The only paradigm which I have found hard to bridge is AOP.

> Then a programmer usually has to wory about lots of
> completely unnecessary "gochas",

I agree the "gotchas" are very annoying, but they are neccessary for the C++ constraints of performance, backwards compatibility, and portability.

> resulting in more effort
> for programmer and more bugs in code.

Yes I agree that they do slow down production and increase bugs. I simply think that one can't dismiss them as being "unneccessary", unless you consider the context of the design goals of the language.

It is my experience that virtually ever dark and dusty corner of C++, no matter how bizarre it appears initially, has been well thought out.

> And, also, it's too hard to write a well-designed library
> in C++.

Contentious as it may be, I agree. Which is why I am designing a new language.

> And this is where C++ has failed most.

Here I disagree. I don't know any language, which is as good for writing libraries (in the general sense). Most other languages, have serious shortcomings which mean that entire application domains can not be addressed with the language. This why Heron resembles C++.

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: What's up with Diggins? Posted: Jan 18, 2006 7:44 AM
Reply to this message Reply
> @Gregor Zeitlinger
>
> > Yes, I just realized that I got that part wrong. I had
> thought that this would not be
> > possible, because I was thinking at how duck typing is
> implemented in Java.
> >Now that I see it in this light, my first concern is less
> of an issue, too. Even if you
> > don't have the implements clause, the IDE can show you
> all traits that a given class
> > participates in.
>
> No, IDE can't do that. That's because IDE can rely only on
> structural subtyping part, not behavioral subtyping. This
> would cause IDE to report some extra traits that a given
> class does not participate in.

Theoretically why couldn't an IDE identify precisely what traits a class participates in? If a compiler can do it, then the compiler can be built into the IDE. However, that is just for the sake of debate.

Just so you know the optional "implements" keyword is currently being integrated into the language. That will make it easy for IDE's to at least identify the major relationships.

A class with an "implements" section, will have several advantages apart from the obvious documentation advantages:
- the compiler will check that the trait is in fact satisfied by the class during the class compilation
- the class will inherit the extension functions of a trait for free

> Also note that this "participate in" relation is (almost)
> transitive… if class C1 "participates in" trait T2, and
> trait T2 "participates in" trait T3, then C1 might
> "participate in" T3.

In fact this is guaranteed.

> The reason I'm putting this up is
> that I think that this problem grows very fast as the
> number of classes and traits grow, and could render this
> IDE feature useless.

That may be true. :-(

> And it would pose a great problem to
> humans, too.

I still think you are overstating the problems with behavioral subtyping, but in the end the programmers will decide.

> So you need that "nominal" and "implements"
> keywords.

I do agree that they will be useful.

Kresimir Cosic

Posts: 34
Nickname: kreso1
Registered: Jan, 2006

Re: What's up with Diggins? Posted: Jan 18, 2006 8:15 AM
Reply to this message Reply
> Theoretically why couldn't an IDE identify precisely what
> traits a class participates in? If a compiler can do it,
> then the compiler can be built into the IDE. However, that
> is just for the sake of debate.

We seem to have a different understanding of "participates in" relation. I think you think :) "participates in" relation is about syntactic conformance, but I think you forgot about "semantic malformance". IDE can't identify "participates in" relation because contract verification is done at runtime!

> Just so you know the optional "implements" keyword is
> currently being integrated into the language. That will
> make it easy for IDE's to at least identify the major
> relationships.

So soon... Great!

> I still think you are overstating the problems with
> behavioral subtyping, but in the end the programmers will
> decide.

That's the best. I even consider it as a kind of experiment. Which can then definitively settle this structural vs nominal debate.

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: What's up with Diggins? Posted: Jan 18, 2006 12:28 PM
Reply to this message Reply
> Theoretically why couldn't an IDE identify precisely what
> traits a class participates in? If a compiler can do it,
> then the compiler can be built into the IDE. However, that
> is just for the sake of debate.
Yes, you are right. I'm not kidding.
Eclipse, for example, has a build-in compiler.
So, what the IDE could show you is
- all traits that a given class participates in, which
- are in the current project (which is parsed by the IDE)

In other words, since the IDE parses all your project files anyway, it can show all occurences where a class is used as a trait - and the reverse: all trait usages of a given class.

What you would not see are trait usages outside of your current project.
But heck: this is the exact reason to create traits in the first place - the ability to use different classes in a uniform way - WITHOUT intent or knowledge of the original designer.

To sum it up:

Intra-project trait usage:
You can use either implements or traits, the IDE can refactor both

Inter-project trait usage:
The IDE cannot refactor files from other projects - but this is not possible with implements either.

Does this sound like a win-only situation?

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: What's up with Diggins? Posted: Jan 18, 2006 1:17 PM
Reply to this message Reply
> Does this sound like a win-only situation?
I did not mean that implements should be replaced by traits.
Rather, that traits are almost as good as the implements

Robert Parnell

Posts: 22
Nickname: robparnl
Registered: Jul, 2005

Re: What's up with Diggins? Posted: Jan 18, 2006 10:50 PM
Reply to this message Reply
Yes, I agree. I hope just your current boss don't claim - you're giving away thier IP properyt, even wenh blogging on your own time.

* You could "show the steps" in building a VList program, instead of just giving us a big heapa thing, then leave it at that.

* Also, I wouldn't mind seeing some "other C++ tools" demonstrated with it, be it debugging, output listings, et cetera. How well is your debugger? Be it VisSut or ddd.

RobP

> >
> > Good luck with the job hunt and all the best with
> Heron.
>
> Thank you very much for the kind words. For the record I
> do plan on continuing my work on Heron, and writing on the
> blog, even if employed at a 9-5. I'll simply have to scale
> back on my crazy ideas. :-)

Flat View: This topic has 36 replies on 3 pages [ « | 1  2  3 ]
Topic: Static Behavioral Subtyping and Heron Traits Previous Topic   Next Topic Topic: Error in

Sponsored Links



Google
  Web Artima.com   

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