Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread james.p.leblanc via Digitalmars-d-learn
On Sunday, 8 August 2021 at 02:00:26 UTC, Tejas wrote: On Saturday, 7 August 2021 at 19:07:04 UTC, Paul Backus wrote: On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote: On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote: [...] Oh wow, and here I thought I was being smart :(

Re: seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread someone via Digitalmars-d-learn
On Sunday, 8 August 2021 at 05:07:17 UTC, jfondren wrote: On Sunday, 8 August 2021 at 04:51:48 UTC, someone wrote: On Sunday, 8 August 2021 at 04:30:12 UTC, rikki cattermole wrote: So a field that will automatically be resolved to as part of the behavior of generated toString methods. No. A

Re: seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread jfondren via Digitalmars-d-learn
On Sunday, 8 August 2021 at 04:51:48 UTC, someone wrote: On Sunday, 8 August 2021 at 04:30:12 UTC, rikki cattermole wrote: So a field that will automatically be resolved to as part of the behavior of generated toString methods. No. A default property can be another object altogether. The

Re: seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread someone via Digitalmars-d-learn
On Sunday, 8 August 2021 at 04:30:12 UTC, rikki cattermole wrote: So a field that will automatically be resolved to as part of the behavior of generated toString methods. No. A default property can be another object altogether. The best use case I can think of is a default collection for a

Re: seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread rikki cattermole via Digitalmars-d-learn
So a field that will automatically be resolved to as part of the behavior of generated toString methods. That really isn't what alias this is used for commonly. I.e. struct ValueReference { private { SomethingElse* impl; } bool isNull() { return impl is

Re: seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread someone via Digitalmars-d-learn
On Sunday, 8 August 2021 at 00:57:47 UTC, Paul Backus wrote: On Sunday, 8 August 2021 at 00:52:43 UTC, someone wrote: Now that I am aware of Walter's stance on alias this: "alias this has turned out to be a mistake" @ https://news.ycombinator.com/item?id=28029184 ... would you, I mean the

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Tejas via Digitalmars-d-learn
On Saturday, 7 August 2021 at 19:07:04 UTC, Paul Backus wrote: On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote: On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote: [...] Oh wow, and here I thought I was being smart :( So, how can we work around this without assembly

Re: Tracy

2021-08-07 Thread SealabJaster via Digitalmars-d-learn
On Saturday, 7 August 2021 at 14:36:39 UTC, Dennis wrote: I'm not aware of any documentation of the feature. Could this be fixed? Or is this intentional?

Re: How suppress (Hide) prompt command console in DMC? Like -mwindows in C++?

2021-08-07 Thread Marcone via Digitalmars-d-learn
On Sunday, 8 August 2021 at 00:23:55 UTC, Adam D Ruppe wrote: On Sunday, 8 August 2021 at 00:02:18 UTC, Marcone wrote: I create a gui program using DMC. I want to know how suppress (Hide) prompt command console in DMC? Like -mwindows in C++. Thank you. use /subsystem:windows a few more

Re: seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 8 August 2021 at 00:52:43 UTC, someone wrote: Now that I am aware of Walter's stance on alias this: "alias this has turned out to be a mistake" @ https://news.ycombinator.com/item?id=28029184 ... would you, I mean the community, think is it a good idea to file a DIP to eventually

seeking advice: possible new @attribute to mark class' default property to avoid alias this ?

2021-08-07 Thread someone via Digitalmars-d-learn
Now that I am aware of Walter's stance on alias this: "alias this has turned out to be a mistake" @ https://news.ycombinator.com/item?id=28029184 ... would you, I mean the community, think is it a good idea to file a DIP to eventually get a new attribute to unambiguously label a class'

Re: How suppress (Hide) prompt command console in DMC? Like -mwindows in C++?

2021-08-07 Thread jfondren via Digitalmars-d-learn
On Sunday, 8 August 2021 at 00:23:55 UTC, Adam D Ruppe wrote: On Sunday, 8 August 2021 at 00:02:18 UTC, Marcone wrote: I create a gui program using DMC. I want to know how suppress (Hide) prompt command console in DMC? Like -mwindows in C++. Thank you. use /subsystem:windows a few more

Re: How suppress (Hide) prompt command console in DMC? Like -mwindows in C++?

2021-08-07 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 8 August 2021 at 00:02:18 UTC, Marcone wrote: I create a gui program using DMC. I want to know how suppress (Hide) prompt command console in DMC? Like -mwindows in C++. Thank you. use /subsystem:windows a few more details here

How suppress (Hide) prompt command console in DMC? Like -mwindows in C++?

2021-08-07 Thread Marcone via Digitalmars-d-learn
I create a gui program using DMC. I want to know how suppress (Hide) prompt command console in DMC? Like -mwindows in C++. Thank you.

Re: What is the value for D to allow assign bool to char/dchar? For me, it must be an error.

2021-08-07 Thread jfondren via Digitalmars-d-learn
On Saturday, 7 August 2021 at 21:45:09 UTC, apz28 wrote: void main() { dchar d; d = false; d = true; char c; c = false; c = true; } true is 1 and false is 0. These are valid char and dchar values. Some people and languages are on

What is the value for D to allow assign bool to char/dchar? For me, it must be an error.

2021-08-07 Thread apz28 via Digitalmars-d-learn
void main() { dchar d; d = false; d = true; char c; c = false; c = true; }

DMC Error: comctl32.lib Error 43: Not a Valid Library File

2021-08-07 Thread Marcone via Digitalmars-d-learn
Using DMC to compile .cpp using gdi32.lib as dmc compile parameter. I get this error: OPTLINK (R) for Win32 Release 8.00.16 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html comctl32.lib Error 43: Not a Valid Library

Re: DMC Error: comctl32.lib Error 43: Not a Valid Library File

2021-08-07 Thread Marcone via Digitalmars-d-learn
I added gdi32.lib user32.lib kernel32.lib comctl32.lib as dmc parameters. But don't work.

Re: Tracy

2021-08-07 Thread JG via Digitalmars-d-learn
On Saturday, 7 August 2021 at 14:36:39 UTC, Dennis wrote: On Friday, 6 August 2021 at 12:30:16 UTC, JG wrote: I guess this means that tracy has been integrated? If this is so is it documented anywhere how to use it? Stefan Koch's WIP tracy integration in DMD is completely separate from Johan

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote: On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote: The issue with `align` attributes being ignored for stack variables is apparently a known bug, first reported in 2016: https://issues.dlang.org/show_bug.cgi?id=16098 The

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Tejas via Digitalmars-d-learn
On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote: On Saturday, 7 August 2021 at 14:34:49 UTC, Tejas wrote: [...] For the array as a whole to be aligned, not only must the spacing between the elements respect the alignment, but starting address of the array itself must be a

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 August 2021 at 14:34:49 UTC, Tejas wrote: Umm, the ```align array``` solution is flat out wrong, please ignore it. Most likely a bug in the compiler. Also, why will the address of the first element of the array ```modulo``` alignment be 0? The address of the array has

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Tejas via Digitalmars-d-learn
On Saturday, 7 August 2021 at 13:36:52 UTC, james.p.leblanc wrote: On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote: [...] **First, thanks all for helping with this question!** The simple desire to arbitrarily align an array is certainly looking non-trivial. Below is a simple

Re: Tracy

2021-08-07 Thread Dennis via Digitalmars-d-learn
On Friday, 6 August 2021 at 12:30:16 UTC, JG wrote: I guess this means that tracy has been integrated? If this is so is it documented anywhere how to use it? Stefan Koch's WIP tracy integration in DMD is completely separate from Johan Engelen's time tracing added to LDC in 1.25.0. Note that

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Tejas via Digitalmars-d-learn
On Saturday, 7 August 2021 at 13:36:52 UTC, james.p.leblanc wrote: On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote: [...] **First, thanks all for helping with this question!** The simple desire to arbitrarily align an array is certainly looking non-trivial. Below is a simple

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread james.p.leblanc via Digitalmars-d-learn
On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote: On Saturday, 7 August 2021 at 07:32:04 UTC, Tejas wrote: And if it really is correct, then it seems once again that static arrays are the answer after all: ```d align(your_alignment) int[your_length] array; ``` No need for structs

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 August 2021 at 07:32:04 UTC, Tejas wrote: And if it really is correct, then it seems once again that static arrays are the answer after all: ```d align(your_alignment) int[your_length] array; ``` No need for structs \\('_')/ The main advantage of the struct is that you can

Re: Setting a hard limit on slice size, is this possible?

2021-08-07 Thread Tejas via Digitalmars-d-learn
On Friday, 6 August 2021 at 22:15:00 UTC, Paul Backus wrote: On Friday, 6 August 2021 at 19:03:53 UTC, Tejas wrote: Stealing Paul's answer now: ```d import std; enum your_max_length = 1000; enum your_align = 256; struct MySlice(T/*, size_t maxLength*/) { private align(your_align)T