March 16, 2018
On Friday, 16 March 2018 at 18:35:14 UTC, Tony wrote:
>
> I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO?

Well, this is not IO, but:

public struct DivInt
{   public int quot;
    public int rem;
}

public static class Utility
{   public static DivInt Div(this int dividee, int divisor)
    {   int quot;
        int rem;
        quot = Math.DivRem(dividee, divisor, out rem);

        //always round down
        if(rem < 0)
        {   quot--;
            rem += divisor;
        }
        return new DivInt{quot = quot, rem = rem};
    }
}

Could be used in some way like:
    int quotient;
    int remainder;
    if (true)
    {   var divResult = (x + y).Div(ASlowFunction());
        quotient = divResult.quot;
        remainder = divResult.rem;
    }


If you say it sucks that one has to declare an utility class just to be nominally object-oriented, I agree.
March 16, 2018
On Friday, 16 March 2018 at 15:58:25 UTC, Steven Schveighoffer wrote:
> 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

Every time I'm thinking that something is impossible to be elegantly and/or easily done even in D - someone proves me wrong.

And common, I just had that little spark of motivation to look into DMD, what is my purpose in life now?
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.


Do you know anything else in the .net library than LINQ where extension methods (somehow equivalent to UFCS) are abused? I thought that something happened in the .net world while I was asleep, that's why I just searched my local copy of .net core and there are exactly 198 extension methods. I would not call these "big".

The Tango remark was just a pun (R.I.P.), since it looked 90% similar to .net. And what would make Tango unusable with UFCS? Is it not written in D?

Last time I checked, .net Console was an enormous static class with three Stream objects behind the scenes.

When I said that phobos looks like a mess compared to .net lib I referred especially to the poor choice of names (eg. RedBlackTree vs SortedDictionary) and lack of essential stuff (eg. happy to have levenshteinDistance built in, but I cannot sort correctly two strings in any other language than English).


March 16, 2018
On Friday, March 16, 2018 21:37:44 Void-995 via Digitalmars-d-announce wrote:
> Every time I'm thinking that something is impossible to be elegantly and/or easily done even in D - someone proves me wrong.
>
> And common, I just had that little spark of motivation to look into DMD, what is my purpose in life now?

Fan it into flames and go learn it so that you can fix or improve other stuff that might come up? ;)

Of course, depending on what you know and are interested in, doing stuff like writing useful libraries and putting them up on code.dlang.org can be of huge benefit even if you never do anything for dmd, druntime, or Phobos. In some ways, that's probably our biggest need. But regardless, if you're interested in helping out the D ecosystem, there are plenty of options.

- Jonathan M Davis

March 17, 2018
On Sunday, 11 March 2018 at 04:06:13 UTC, Nick Sabalausky (Abscissa) wrote:
> On 03/10/2018 05:47 AM, Dylan Graham wrote:
>> On Saturday, 10 March 2018 at 10:05:49 UTC, rumbu wrote:
>>>
>>> According to the State of D Survey, 71% of the respondents don't care about betterC. Why is betterC on the priority list?
>> 
>> Yeah. Why should D worry about tying itself into C when it can't even interface with itself through DLLs?
>
> First of all, betterC is about far more than interfacing with C. In fact, interop with C isn't really what betterC is about at all - that's a separate aspect of the language. (And those C/C++ users who still haven't come to D - for many of them the holdout is *because* of the issues betterC aims to address. Make no mistake, for all the stockholm syndrome in the C and C++ worlds, there *are* a lot people openly wanting to jump ship but don't have a sufficient option yet. Heck, *I'm* a C/C++ -> D convert.)
>
> But more importantly:
>
> The D language itself is specifically designed and intended to be multi-purpose. Because of that, D users (and potential D users) are *highly* diverse. Everybody here has their own use-cases, their own needs and priorities, and their own list of things they want fixed yesterday.
>
> In a group this diverse, there just simply *isn't* much on the D wishlist that's crucially important to a *majority*, because we all need completely different things.
>
> Personally, better DLL support have little to no impact on me. Obviously it does for you, and I sympathise. Some of the things most important to me for D to improve you probably wouldn't care one bit about - and that's ok. We work on different sorts of things.
>
> Improved betterC is something I would find very nice if I ever have time or opportunity to get back into embedded software. But outside of that, yea, it doesn't impact me much more than it does for you.
>
> But here's the rub: In this crowd here, probably far more than most languages, we all have such wildly varying needs that 29% *is* what qualifies as significant around here. Most wishlist items are going to have similarly non-majority numbers. And they have to pick *something* to focus on. Luckily, as the vision document clearly states, there are *several* such "somethings" the dlang foundation is committing to working on.



The D language is a marvel. It just nice using it. It is a superior language.
It is pure joy programming in D. D language is mature enough to write up to 90% of all form of application. The problem I have seen thus far is the tools. The tools don't work especially on Windows.


The only working ide on Windows is visual-D but tied to visual studio. Personally don't like visual studio, it look to old for my likely. The plugin for eclipse,visual studio code and intellij are really lacking behind.


I having trying to setup code-d up in vs code for more than six months now to get auto completion but to no success. I have spent countless hours on the internet search for a solution but did not find any. I just get all kinds of errors. My next plane is to by a Linux system. So to me D is a beautiful language with no beautiful tools so not usable to me yet.

All you need to set up dmd on Windows is to download it and install.it is less than 2mins, you are good to go. Running your code in command line is painless with dub. But who want to write a millions of lines of code using plan text editors without code hinting, auto complete and superior debuging?

I love D language so much. The language is true mature now. Fix the following problem

* Get the plugin for intellij, eclipse and vs code working especially on Windows
* Proper documentation for the various packages and library
*Make installation process as easy as installing dmd
*Books that touch all capability of the D langauge with real like application. Programming in D is good but it must be enchance further


D language must be easy to program on all pupular ide. All you need to write c# code in vs code is just two or three extension. There is code hinting, auto complete etc. Why will I not use C# in vs code? I have no reason. Good language with good tools- anybody will give it a trier


Walter and all the team have done a good job. But give me more pride to sell D to all my colleagues. Programmers are known to be proud of their language, they must have very good reasons to switch. People switch from one languge to another because the new language just easy their pain.

All the members of the D community must come together and face really and work together to move the language further to make D the number one langauge which is what D supposed to be.


Working individually have move us here but working collectively will definitely make us the best. We must give people on all platform- windows, Mac, Linux,intellij,exclipse, netbeam,vs code, visual studio etc good reasons to use D besides the beaulty and power of the language.

Love D and all involves



March 17, 2018
On Friday, 16 March 2018 at 19:08:47 UTC, Nick Sabalausky (Abscissa) wrote:
> 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);
>     }
> }

Actually it's like:

static void SomeFunc(this Bar bar, int num) { ... }
March 18, 2018
On Friday, 16 March 2018 at 18:15:02 UTC, David Nadlinger wrote:
> 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

I stand corrected. I remembered something about druntime being used but last time I checked front end code was filled with strcpm and strlen, wrongly assumed that druntime was not used. Oh well...

Still, probably D compilers will benefit from fixing mangling bugs and allow more integration with C++ std, right?
March 18, 2018
On Sunday, 18 March 2018 at 10:28:58 UTC, Radu wrote:
> On Friday, 16 March 2018 at 18:15:02 UTC, David Nadlinger wrote:
>> 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
>
> I stand corrected. I remembered something about druntime being used but last time I checked front end code was filled with strcpm and strlen, wrongly assumed that druntime was not used. Oh well...

You're not completely wrong about this: the dmd frontend uses almost nothing from druntime, not counting extern(C) declarations that are really from the local libc, and nothing from Phobos. However, I think it still requires druntime to be linked against because of some compiler-generated symbols and the like.  Also, LDC using the D frontend has allowed a few Phobos dependencies to creep in.

So where you were wrong is in saying dmd/ldc use betterC, which is an extreme that precludes linking against druntime or Phobos at all, though you could still use extern(C) declarations alone from the stdlib. What you may have been thinking of is Walter's plan to move the dmd backend to D written with betterC, because he'd like to use that same D backend with his C/C++ compiler frontends written in C/C++ and he wants to dogfood betterC there.

You weren't wrong that the dmd frontend is very much written in a betterC style, it just isn't fully usable with betterC yet.

> Still, probably D compilers will benefit from fixing mangling bugs and allow more integration with C++ std, right?

Sure, David was simply pointing out that the betterC and extern(C++) efforts are orthogonal and that one doesn't imply the other: the ddmd frontend is an example of this, extensively using extern(C++) but not enabling betterC.
March 19, 2018
On Friday, 16 March 2018 at 18:35:14 UTC, Tony wrote:
> I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO?

All methods of Console class.
March 19, 2018
On Friday, 16 March 2018 at 21:38:30 UTC, rumbu wrote:
> Do you know anything else in the .net library than LINQ where extension methods (somehow equivalent to UFCS) are abused? I thought that something happened in the .net world while I was asleep, that's why I just searched my local copy of .net core and there are exactly 198 extension methods. I would not call these "big".

It's big because linq is perceptionally big in itself similar to how std.algorithm is big. It's also design pattern in C#: if you want a complex interface method with simplified overloads, you don't declare interface with many overloads, you declare one interface method that takes all parameters and a number of simplified extension methods that forward to interface, Unity container and Rhino mocks are designed this way.

> Last time I checked, .net Console was an enormous static class with three Stream objects behind the scenes.

That's also how D console IO works.

> When I said that phobos looks like a mess compared to .net lib I referred especially to the poor choice of names (eg. RedBlackTree vs SortedDictionary) and lack of essential stuff (eg. happy to have levenshteinDistance built in, but I cannot sort correctly two strings in any other language than English).

That's true, naming is a little complex.