Thread overview
Default function parameters of other function parameters
Oct 30, 2018
Your name
Oct 31, 2018
Adam D. Ruppe
Oct 31, 2018
Your name
Oct 31, 2018
Seb
Oct 31, 2018
bachmeier
Nov 01, 2018
Bastiaan Veelo
Nov 01, 2018
bachmeier
Nov 01, 2018
Bastiaan Veelo
Nov 01, 2018
welkam
October 30, 2018
I think it would be nice if default function parameters could be defined as other parameters to the function, like this:
========CODE========
class Rectangle
{
    int width;
    int height;

    this(int initialWidth, int initialHeight = initialWidth) {
        width = initialWidth;
        height = initialHeight;
    }
}

void main()
{
    import std.stdio;
    auto myRectangle = new Rectangle(5, 17);
    auto mySquare = new Rectangle(5);//pass only one parameter to make a square
}
========END OF CODE===

Side note: Am I missing something, or is there no code snippets on these forums? `backticks` don't do anything. Being a forum about a programming language, there should really be a way to embed snippets of code 😆!
October 31, 2018
On Tuesday, 30 October 2018 at 21:54:11 UTC, Your name wrote:
> I think it would be nice if default function parameters could be defined as other parameters to the function, like this:

You can't do that, but you can do

this(int initialWidth, int initialHeight) {
  width = initialWidth;
  height = initialHeight;
}
this(int initialWidth) {
  this(initialWidth, initialWidth);
}


and it isn't a huge amount of code to add and forward and quite flexible in various options.

> there should really be a way to embed snippets of code 😆!

You just type it up lol we can all read it.
October 31, 2018
On Wednesday, 31 October 2018 at 01:51:38 UTC, Adam D. Ruppe wrote:
> You just type it up lol we can all read it.

Are these forums open source? I think i'll add it myself.
October 31, 2018
On Wednesday, 31 October 2018 at 02:25:56 UTC, Your name wrote:
> On Wednesday, 31 October 2018 at 01:51:38 UTC, Adam D. Ruppe wrote:
>> You just type it up lol we can all read it.
>
> Are these forums open source? I think i'll add it myself.

https://github.com/CyberShadow/DFeed
October 31, 2018
On Wednesday, 31 October 2018 at 02:25:56 UTC, Your name wrote:
> On Wednesday, 31 October 2018 at 01:51:38 UTC, Adam D. Ruppe wrote:
>> You just type it up lol we can all read it.
>
> Are these forums open source? I think i'll add it myself.

Just so you know, this isn't a traditional forum, it's a web interface to the mailing list. Therefore I don't think it will be accepted.
November 01, 2018
On Wednesday, 31 October 2018 at 13:09:05 UTC, bachmeier wrote:
> On Wednesday, 31 October 2018 at 02:25:56 UTC, Your name wrote:
>> Are these forums open source? I think i'll add it myself.
>
> Just so you know, this isn't a traditional forum, it's a web interface to the mailing list. Therefore I don't think it will be accepted.

Why wouldn’t it be accepted? It’s just markup. People read back ticks in their code all the time, so it’s no problem to read it in mail. The forum can decide to format it however it likes, maybe even make code snippets runnable.
November 01, 2018
On Thursday, 1 November 2018 at 06:55:02 UTC, Bastiaan Veelo wrote:
> On Wednesday, 31 October 2018 at 13:09:05 UTC, bachmeier wrote:
>> On Wednesday, 31 October 2018 at 02:25:56 UTC, Your name wrote:
>>> Are these forums open source? I think i'll add it myself.
>>
>> Just so you know, this isn't a traditional forum, it's a web interface to the mailing list. Therefore I don't think it will be accepted.
>
> Why wouldn’t it be accepted? It’s just markup. People read back ticks in their code all the time, so it’s no problem to read it in mail. The forum can decide to format it however it likes, maybe even make code snippets runnable.

I'm not saying I'm opposed, just that my impression from previous discussions is that there is a preference to keep things as plain text, and I don't want someone spending time on something that doesn't go anywhere.
November 01, 2018
On Thursday, 1 November 2018 at 10:33:14 UTC, bachmeier wrote:
> On Thursday, 1 November 2018 at 06:55:02 UTC, Bastiaan Veelo wrote:
>> On Wednesday, 31 October 2018 at 13:09:05 UTC, bachmeier wrote:
>>> On Wednesday, 31 October 2018 at 02:25:56 UTC, Your name wrote:
>>>> Are these forums open source? I think i'll add it myself.
>>>
>>> Just so you know, this isn't a traditional forum, it's a web interface to the mailing list. Therefore I don't think it will be accepted.
>>
>> Why wouldn’t it be accepted? It’s just markup. People read back ticks in their code all the time, so it’s no problem to read it in mail. The forum can decide to format it however it likes, maybe even make code snippets runnable.
>
> I'm not saying I'm opposed, just that my impression from previous discussions is that there is a preference to keep things as plain text, and I don't want someone spending time on something that doesn't go anywhere.

I thought I had seen a post from Vladimir where he considered adding support for markup, but maybe I misremember. There is this older post https://forum.dlang.org/post/invscqkyjhkrxpcqqscn@beta.forum.dlang.org talking about issues with this. Maybe solutions can be found for all of these, like user preference or a "raw" button, but it does require thought and possibly convincing.
November 01, 2018
On Thursday, 1 November 2018 at 06:55:02 UTC, Bastiaan Veelo wrote:
> maybe even make code snippets runnable.

Or you can use https://run.dlang.io/  or https://godbolt.org/


November 01, 2018
On 11/1/18 6:33 AM, bachmeier wrote:
> On Thursday, 1 November 2018 at 06:55:02 UTC, Bastiaan Veelo wrote:
>> On Wednesday, 31 October 2018 at 13:09:05 UTC, bachmeier wrote:
>>> On Wednesday, 31 October 2018 at 02:25:56 UTC, Your name wrote:
>>>> Are these forums open source? I think i'll add it myself.
>>>
>>> Just so you know, this isn't a traditional forum, it's a web interface to the mailing list. Therefore I don't think it will be accepted.
>>
>> Why wouldn’t it be accepted? It’s just markup. People read back ticks in their code all the time, so it’s no problem to read it in mail. The forum can decide to format it however it likes, maybe even make code snippets runnable.
> 
> I'm not saying I'm opposed, just that my impression from previous discussions is that there is a preference to keep things as plain text, and I don't want someone spending time on something that doesn't go anywhere.

I don't see any reason why it wouldn't be accepted. I couldn't care less if people write markdown on the NG, even though I don't use the forum. It's still readable on thunderbird (which does do some markdown, but no code formatting).

For the record, vibed forums do have markdown:

http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/56653/

And they are backed by NNTP (or maybe there's an NNTP interface? I'm not sure actually).

-Steve