Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: Declaration...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 44 of 50 Topic 1065 of 1203
Post > Topic >>

Re: Declaration design preference: type or name first

by Robbert Haarman <comp.lang.misc@[EMAIL PROTECTED] > Nov 13, 2007 at 09:43 AM

On Mon, Nov 12, 2007 at 03:18:18PM -0800, James Harris wrote:
> On 12 Nov, 11:17, Robbert Haarman <comp.lang.m...@[EMAIL PROTECTED]
>
> wrote:
> > On Sun, Nov 11, 2007 at 10:10:54AM -0800, James Harris wrote:
> > > On 6 Nov, 08:39, torb...@[EMAIL PROTECTED]
 (Torben ?gidius Mogensen)
> >
> > > > > Sorry, can't bring myself to go with inferred types. (Why do you
like
> > > > > them?)
> >
> > > > For several reasons:
> >
> > > >  1. It makes the programs shorter.
> >
> > > But it also makes them ambiguous.
> >
> > I don't see what you mean here. As long as the behavior of the type
> > inferencer is well-specified, I don't think there is anything about
type
> > inference that makes programs ambiguous.
> 
> We are getting into areas I am not really ready yet to discuss but
> since you asked I am thinking of two cases (rightly or wrongly):
> 
> 1. a human /reader/ would not know what data types were meant without
> examining a lot of context.
> 
> 2. the code could easily apply more widely than the /writer/ intended
> (or wanted).

True, but neither of these make the program _ambiguous_. Whether they 
are actually problems is a different matter, and since you indicated 
that we are drifting away from what you wanted to discuss, I will not 
get into that discussion now.

> > > >  2. You don't have to decide in advance how polymorphic/generic
your
> > > >     functions are -- the type inference makes them maximally
> > > >     polymorphic.
> >
> > > I want control over how polymorphic functions are.
> >
> > You can have type inference and still be allowed to specify types.
Then
> > you have control for when you need it, and succinctness when you want
> > it.
> 
> I see your point. Lets say that if I read someone else's code I want
> to be able to see how polymorphic his functions are!

I see your point, but I feel it is getting the territory of "everybody 
should do things the way I want them cause I think that's better for 
me!". Type inference saves you work while developing and refactoring 
code. This benefits everybody working on the project, including you.

I would like to add that type annotations have real value, and, in fact, 
it is considered good practice to add them by the Haskell and OCaml 
communities, even though these language do not mandate them. What I 
typically do is write my code without type annotations first (saving 
effort while adding and refactoring code), and then, when the time comes 
for type annotations (for example, because I want to share the code with 
someone else, or I am not sure about the inferred types myself), I have 
the compiler generate the type annotations for me. This lets me focus on 
the algorithms and the structure of the code, rather than annotations, 
while still providing the latter.

Regards,

Bob

-- 
67.7234597% of statistics are made up.
 




 50 Posts in Topic:
Declaration design preference: type or name first
James Harris <james.ha  2007-10-30 06:25:49 
Re: Declaration design preference: type or name first
Christopher Barber <cb  2007-10-30 12:04:41 
Re: Declaration design preference: type or name first
Robbert Haarman <comp.  2007-10-31 11:18:39 
Re: Declaration design preference: type or name first
Marco van de Voort <ma  2007-10-31 14:53:22 
Re: Declaration design preference: type or name first
"cr88192" <c  2007-10-31 08:29:19 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-10-30 16:01:31 
Re: Declaration design preference: type or name first
"cr88192" <c  2007-10-31 11:22:00 
Re: Declaration design preference: type or name first
Logan Shaw <lshaw-usen  2007-10-30 21:54:26 
Re: Declaration design preference: type or name first
Mike Sieweke <msieweke  2007-10-31 22:47:45 
Re: Declaration design preference: type or name first
CBFalconer <cbfalconer  2007-10-31 22:38:47 
Re: Declaration design preference: type or name first
Marco van de Voort <ma  2007-11-01 08:38:05 
Re: Declaration design preference: type or name first
Logan Shaw <lshaw-usen  2007-10-31 23:45:26 
Re: Declaration design preference: type or name first
Mike Sieweke <msieweke  2007-11-01 21:26:24 
Re: Declaration design preference: type or name first
Richard Heathfield <rj  2007-11-01 05:31:44 
Re: Declaration design preference: type or name first
Marco van de Voort <ma  2007-11-01 08:39:55 
Re: Declaration design preference: type or name first
Richard Heathfield <rj  2007-11-01 08:59:25 
Re: Declaration design preference: type or name first
Marco van de Voort <ma  2007-11-01 08:38:56 
Re: Declaration design preference: type or name first
cri@[EMAIL PROTECTED] (R  2007-11-01 14:40:44 
Re: Declaration design preference: type or name first
ram@[EMAIL PROTECTED] (S  2007-11-01 14:50:16 
Re: Declaration design preference: type or name first
cri@[EMAIL PROTECTED] (R  2007-11-01 15:52:23 
Re: Declaration design preference: type or name first
Logan Shaw <lshaw-usen  2007-11-01 20:09:07 
Re: Declaration design preference: type or name first
cri@[EMAIL PROTECTED] (R  2007-11-02 03:52:34 
Re: Declaration design preference: type or name first
Logan Shaw <lshaw-usen  2007-11-02 00:57:24 
Re: Declaration design preference: type or name first
cri@[EMAIL PROTECTED] (R  2007-11-03 15:53:21 
Re: Declaration design preference: type or name first
"cr88192" <c  2007-11-03 22:27:59 
Re: Declaration design preference: type or name first
thomas.mertes@[EMAIL PROT  2007-10-30 23:48:38 
Re: Declaration design preference: type or name first
thomas.mertes@[EMAIL PROT  2007-10-31 00:12:07 
Re: Declaration design preference: type or name first
torbenm@[EMAIL PROTECTED]  2007-10-31 09:27:23 
Re: Declaration design preference: type or name first
thomas.mertes@[EMAIL PROT  2007-10-31 01:38:54 
Re: Declaration design preference: type or name first
Marco van de Voort <ma  2007-10-31 14:45:15 
Re: Declaration design preference: type or name first
Ed Prochak <edprochak@  2007-10-31 17:28:45 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-01 13:56:47 
Re: Declaration design preference: type or name first
"cr88192" <c  2007-11-02 16:01:12 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-02 01:08:01 
Re: Declaration design preference: type or name first
CBFalconer <cbfalconer  2007-11-02 07:51:18 
Re: Declaration design preference: type or name first
Tzy-Jye Daniel Lin <dt  2007-11-03 03:28:22 
Re: Declaration design preference: type or name first
"cr88192" <c  2007-11-03 21:54:27 
Re: Declaration design preference: type or name first
torbenm@[EMAIL PROTECTED]  2007-11-05 09:56:58 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-05 10:33:42 
Re: Declaration design preference: type or name first
torbenm@[EMAIL PROTECTED]  2007-11-06 09:39:46 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-11 10:10:54 
Re: Declaration design preference: type or name first
Robbert Haarman <comp.  2007-11-12 12:17:10 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-12 15:18:18 
Re: Declaration design preference: type or name first
Robbert Haarman <comp.  2007-11-13 09:43:11 
Re: Declaration design preference: type or name first
torbenm@[EMAIL PROTECTED]  2007-11-13 10:14:08 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-13 15:47:48 
Re: Declaration design preference: type or name first
Robbert Haarman <comp.  2007-11-14 03:36:24 
Re: Declaration design preference: type or name first
anw@[EMAIL PROTECTED] (D  2007-11-14 13:11:46 
Re: Declaration design preference: type or name first
torbenm@[EMAIL PROTECTED]  2007-11-14 11:36:07 
Re: Declaration design preference: type or name first
James Harris <james.ha  2007-11-13 16:04:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 20 0:01:49 CDT 2008.