March 15, 2018
On Thursday, 15 March 2018 at 21:10:47 UTC, flamencofantasy wrote:
> On Wednesday, 14 March 2018 at 05:22:53 UTC, rumbu wrote:
>
>> I doubt that this was the blocker because C# had ArraySegment<T> since .net framework 2.0 (2006), which is exactly a slice, but doesn't have the syntactic sugar for it.
>
> If it doesn't have the syntactic sugar how is it "exactly a slice"?

This was about the fact that slices were a stopper for a D .net implementation.

The direct translation of the code here (https://dlang.org/articles/d-array-article.html#introducing-slices) is:

int[] a = new int[5];
var b = new ArraySegment<int>(a, 0, 2);
var c = new ArraySegment<int>(a, 3, 2);
c[0] = 4;
c[1] = 5;
c.CopyTo(b);

Surprise, the a content is the same as in D - [4,5,0,4,5].

I will stop my fallacy here, I promise this is the last post bragging about array segments, I feel some tension piling up on D forums and I don't want to contribute to it. My mistake was the use of the word "exactly".

March 16, 2018
On Thursday, 15 March 2018 at 18:39:08 UTC, rumbu wrote:
> My quote is out of context. Somebody asked surprised why C# developers are interested in D. For me (mainly a C# developer), this is the main reason: native compilation (and this includes memory management). I highlighted the fact that the C# team keep implementing D specific ideas in each new version, so don't be surprised if your list of D exclusive features becomes smaller with each new C# iteration. My complaint was the fact that D drops features or push them into library solutions.

That was me ;-)

Yeah..native compilation is so nice..it's hard to resist.
And so is a good GC implementation (does D have one of those ??)

btw. run your C# or Java program for long enough, and it's essentially native compiled anyway. When I run some of my java programs, I still don't know how 'native compilation' would make it go any faster (noticably). Same goes for my C# Windows Forms apps..they just fly...native compilation wouldn't add much.

btw C# has had slices since day 1. Just required an extra forklift or two - as opposed to taking it off the nearby shelf.

-------------
using System;
using System.IO;

public class Program
{
    public static int Main()
    {
        int[] arr = { 1, 2, 3, 4, 5 };
        int[] sliceOfArr = arr.Slice(2, 3);

        Console.WriteLine(string.Join(", ", arr));
        Console.WriteLine(string.Join(", ", sliceOfArr));

        return 0;
    }
}

public static class Utils
{
    public static T[] Slice<T>(this T[] arr, int start, int len)
    {
        T[] slice  = new T[len];
        Array.Copy(arr, start, slice, 0, len);
        return slice;
    }
}
------------
March 16, 2018
On Friday, 16 March 2018 at 01:45:57 UTC, psychoticRabbit wrote:
> On Thursday, 15 March 2018 at 18:39:08
>
> public static class Utils
> {
>     public static T[] Slice<T>(this T[] arr, int start, int len)
>     {
>         T[] slice  = new T[len];
>         Array.Copy(arr, start, slice, 0, len);
>         return slice;
>     }
> }

Playing captain the obvious but this is COPY not slice. Slices in D share underlying array, something that C# recently recognized as special Span<T> class that may point to GC heap or off-heap memory.

D had slices since 2000s, pointing to any kind of memory.

March 16, 2018
On 3/15/2018 3:48 AM, Radu wrote:
> Lastly, the objective is a bit vague - there is no scope attached to it, maybe this needs clarifications. Even if it means fixing all the logged bugs related to it, it is a great step, at least for me.

For reference, here are all the betterC bugs:

https://issues.dlang.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&keywords=betterC%2C%20&keywords_type=allwords&list_id=220294&query_format=advanced

If there are any betterC bugs filed in Bugzilla and not listed there, please tak them with the "betterC" keyword so they will be. Any unfiled bugs => file them, of course!
March 16, 2018
On Friday, 16 March 2018 at 07:58:33 UTC, Dmitry Olshansky wrote:
> Playing captain the obvious but this is COPY not slice.

Shh. Don't tell my customers that.


> D had slices since 2000s, pointing to any kind of memory.

Mmm..D showing off.. as always ;-)

March 16, 2018
On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote:
> Are you sure that you are talking about phobos and not tango? :)
> I'm eager to find how I'm uninformed.

Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it.
March 16, 2018
On 3/12/18 10:57 AM, Void-995 wrote:
> On Monday, 12 March 2018 at 10:38:57 UTC, bachmeier wrote:
>> On Monday, 12 March 2018 at 05:02:31 UTC, Jonathan M Davis wrote:
>>> Now, I actually understand ranges and am very glad that they're there, but as a D newbie, they were annoying, because they were unfamiliar.
>>
>> Ranges are D's monads. The only thing missing is the burrito tutorials.
> 
> I always thought the best spice in D is UFCS. If only there would be one for local symbols (but that needs either foundation's decision or I need to write my first DIP and do something instead of just crying silently into my sleeve).

alias I(alias X) = X;

void main()
{
   int y = 5;
   int bar(int x) { return y * x; }
   // auto z = 6.bar; // error
   auto z = 6.I!bar; // OK
}

https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/

-Steve
March 16, 2018
On Thursday, 15 March 2018 at 10:48:45 UTC, Radu wrote:
> You have to remember that the really big first client of betterC(++) was DMD, porting DMD from C++ was a big undertaking. Right now both DMD and LDC use a form of betterC, so it is critical to have it finalized.

This is entirely wrong. DMD and LDC rely extern(C++), but this has nothing to do with -betterC whatsoever.

Both compilers link and initialise the runtime as normal (and then disable the GC at runtime).

 — David
March 16, 2018
On Friday, 16 March 2018 at 15:04:21 UTC, Kagamin wrote:
> On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote:
>> Are you sure that you are talking about phobos and not tango? :)
>> I'm eager to find how I'm uninformed.
>
> Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it.

I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO?


March 16, 2018
On 03/16/2018 02:35 PM, Tony wrote:
> On Friday, 16 March 2018 at 15:04:21 UTC, Kagamin wrote:
>> On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote:
>>> Are you sure that you are talking about phobos and not tango? :)
>>> I'm eager to find how I'm uninformed.
>>
>> Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it.
> 
> I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO?
> 

It doesn't (last I used it), buy you CAN mark individual member functions to be usable UFCS-like. IIRC, I think it might have to be static member function.

It's been awhile, so I don't remember it exactly, but it's something like this:

class Bar {}

class Foo {
    static void SomeFunc(extention Bar bar, int num) {...}
}

class MyApp {
    static void Run() {
        Bar bar = new Bar();
        bar.SomeFunc(2);
    }
}