September 14, 2012
It'd be great if the guy doing Visual D could give it a try. We could also resolve the property vs function issue in a similar manner to avoid the need to enforce unnecessary brackets everywhere. It would seem like a more practical approach than breaking all D2 code that actually addresses the legitimate issue.

September 18, 2012
On Mon, Sep 10, 2012 at 1:36 PM, Timon Gehr <timon.gehr@gmx.ch> wrote:

>
> Yes, Go uses explicit pointer types.
> Regarding Rust, you are wrong.
> I have built the latest Rust compiler.
>
> import io;
>
> fn modify(&a:int){
>     a = 2;
> }
> fn swap<T>(&a:T,&b:T){
>    let tmp<-a;
>    a<-b;
>    b<-tmp;
> }
>
>
The `fn foo(&a: T)` syntax is being deprecated in favor of `fn foo(a: &mut
T)`.

So your modify function becomes: `fn modify(a: &mut int)`, and gets called
as `modify(&mut a)`.

Your swap function becomes `fn swap<T>(a: &mut T, b: &mut T)` and gets
called as `swap(&mut a, &mut b)`.

So effectively, Rust also opted for explicit ref at the call site.

--
Ziad


September 19, 2012
On 09/18/2012 11:26 PM, Ziad Hatahet wrote:
> On Mon, Sep 10, 2012 at 1:36 PM, Timon Gehr <timon.gehr@gmx.ch
> <mailto:timon.gehr@gmx.ch>> wrote:
>
>
>     Yes, Go uses explicit pointer types.
>     Regarding Rust, you are wrong.
>     I have built the latest Rust compiler.
>
>     import io;
>
>     fn modify(&a:int){
>          a = 2;
>     }
>     fn swap<T>(&a:T,&b:T){
>         let tmp<-a;
>         a<-b;
>         b<-tmp;
>     }
>
>
> The `fn foo(&a: T)` syntax is being deprecated in favor of `fn foo(a:
> &mut T)`.
>
> So your modify function becomes: `fn modify(a: &mut int)`, and gets
> called as `modify(&mut a)`.
>
> Your swap function becomes `fn swap<T>(a: &mut T, b: &mut T)` and gets
> called as `swap(&mut a, &mut b)`.
>
> So effectively, Rust also opted for explicit ref at the call site.
>
> --
> Ziad

I see. Thank you for the clarification.
September 19, 2012
I'm amazed and very pleased at the discussion that this has generated.  I think it would be great if ref and out required for function calls in D3.  As others have mentioned, it would greatly assist with code readability.

On Friday, 7 September 2012 at 11:33:41 UTC, Kevin McTaggart wrote:
> I've been looking at migrating a reasonably large ship motion library (tens of thousands of lines) from C# to D.  I've become quite enthusiastic about D, and most of my problems have been relatively minor (e.g., inconsistent bugs with std.container.Array, would like orange serialization to give me an error telling me I didn't register a class before calling serialize).  I suggest that the language require ref and out when calling functions, as C# requires.  This would make code easier to understand, and would also eliminate the problem I had when the wrong function from the following choices was mistakenly called:
>
> parseLineInts(string text, int positionStart, out int j0, out int j1)
>
> parseLineInts(string text, out int j0, out int j1, out int j2)
>
> I note that the second function calls another function as follows:
> int positionStart = 1;
> parseLineInts(text, positionStart, j0, j1, j2);
>
> I look forward to seeing feedback from D experts.  This is the only significant change that I could think of recommending for the language.


Next ›   Last »
1 2 3 4 5 6 7
Top | Discussion index | About this forum | D home