On Friday, 6 August 2021 at 04:57:02 UTC, Ali Çehreli wrote:
May I humbly suggest names like Location instead of
structureLocation to make refactoring even more
straightforward. ;)
just renamed everything like following:
- sWhatever for structures
- iWhatever for interfaces
- cWhatever for c
On Thursday, 5 August 2021 at 01:14:26 UTC, H. S. Teoh wrote:
On Thu, Aug 05, 2021 at 12:47:06AM +, someone via
Digitalmars-d-learn wrote:
[...]
1) If the constant is a POD (int, float, etc.), use:
enum myValue = ...;
2) If the constant is a string or some other array:
s
On Friday, 6 August 2021 at 04:57:02 UTC, Ali Çehreli wrote:
On 8/5/21 5:11 PM, someone wrote:
> Although I have very little experience with D, I second this:
> refactoring, even huge refactors, proved to be far more
straightforward
> than I expected.
May I humbly suggest names like Location in
On 8/5/21 5:11 PM, someone wrote:
> Although I have very little experience with D, I second this:
> refactoring, even huge refactors, proved to be far more straightforward
> than I expected.
May I humbly suggest names like Location instead of structureLocation to
make refactoring even more stra
On Thursday, 5 August 2021 at 20:50:38 UTC, Steven Schveighoffer
wrote:
I mean eventually AAs that are reasonably available at compile
time, even though the structure is determined by the runtime,
should be available at compile time. This allows them to be as
usable with static immutable as r
On Thursday, 5 August 2021 at 17:12:13 UTC, H. S. Teoh wrote:
[...]
I'd say if the performance hit isn't noticeably bad right now,
don't worry too much about it. You can always replace it later.
One thing I really like about D is how easily refactorable D
code tends to be. If you structure yo
On 8/5/21 11:09 AM, someone wrote:
On Thursday, 5 August 2021 at 10:28:00 UTC, Steven Schveighoffer wrote:
H.S. Teoh, I know you know better than this ;) None of this is
necessary, you just need `rtValue` for both runtime and CTFE (and
compile time parameters)!
Now, the original question is
On Thu, Aug 05, 2021 at 04:53:38PM +, someone via Digitalmars-d-learn wrote:
[...]
> I already assumed that loading the data from file is a goner.
>
> So this leaves me with two choices:
>
> - keep the code as it is incurring higher-than expected
> compilation-time: this is solely used in a m
On Thursday, 5 August 2021 at 16:24:21 UTC, jfondren wrote:
On Thursday, 5 August 2021 at 16:06:58 UTC, someone wrote:
So if we are talking AA-arrays at compile-time only there
should be nothing wrong with the following code ... right ?
...
private enum pudtLocations = [
r"BUE"d : structure
On Thursday, 5 August 2021 at 16:06:58 UTC, someone wrote:
So if we are talking AA-arrays at compile-time only there
should be nothing wrong with the following code ... right ?
...
private enum pudtLocations = [
r"BUE"d : structureLocation(r"arg"d, r"Buenos Aires"d,
r"ART"d),
r"GRU"d :
On Thursday, 5 August 2021 at 15:26:33 UTC, H. S. Teoh wrote:
On Thu, Aug 05, 2021 at 03:09:13PM +, someone via
Digitalmars-d-learn wrote:
On Thursday, 5 August 2021 at 10:28:00 UTC, Steven
Schveighoffer wrote:
> H.S. Teoh, I know you know better than this ;) None of this
> is necessary,
On Thu, Aug 05, 2021 at 03:09:13PM +, someone via Digitalmars-d-learn wrote:
> On Thursday, 5 August 2021 at 10:28:00 UTC, Steven Schveighoffer wrote:
>
> > H.S. Teoh, I know you know better than this ;) None of this is
> > necessary, you just need `rtValue` for both runtime and CTFE (and
> >
On Thursday, 5 August 2021 at 10:28:00 UTC, Steven Schveighoffer
wrote:
H.S. Teoh, I know you know better than this ;) None of this is
necessary, you just need `rtValue` for both runtime and CTFE
(and compile time parameters)!
Now, the original question is about *associative arrays*, which
On 8/4/21 11:20 PM, H. S. Teoh wrote:
On Thu, Aug 05, 2021 at 01:39:42AM +, someone via Digitalmars-d-learn wrote:
[...]
What happens in the following case ?
public immutable enum gudtLocations = [
r"BUE"d : structureLocation(r"arg"d, r"Buenos Aires"d, r"ART"d),
r"GRU"d : structureL
On Thursday, 5 August 2021 at 03:20:17 UTC, H. S. Teoh wrote:
On Thu, Aug 05, 2021 at 01:39:42AM +, someone via
Digitalmars-d-learn wrote: [...]
What happens in the following case ?
public immutable enum gudtLocations = [
r"BUE"d : structureLocation(r"arg"d, r"Buenos Aires"d,
r"ART"d),
On Thursday, 5 August 2021 at 02:43:09 UTC, Steven Schveighoffer
wrote:
The main difference between enums and static immutable is that
the latter has an address at runtime.
This. Gotcha.
So the answer is, depends on what you are going to do with the
data. There are use cases for both. If you
On Thu, Aug 05, 2021 at 01:39:42AM +, someone via Digitalmars-d-learn wrote:
[...]
> What happens in the following case ?
>
> public immutable enum gudtLocations = [
>r"BUE"d : structureLocation(r"arg"d, r"Buenos Aires"d, r"ART"d),
>r"GRU"d : structureLocation(r"bra"d, r"São Paulo"d, r
On 8/4/21 10:27 PM, someone wrote:
On Thursday, 5 August 2021 at 02:06:13 UTC, Steven Schveighoffer wrote:
On 8/4/21 9:14 PM, H. S. Teoh wrote:
Unless you have a specific reason to, avoid using `enum` with string and
array literals, because they will trigger a memory allocation *at every
single
On Thursday, 5 August 2021 at 02:06:13 UTC, Steven Schveighoffer
wrote:
On 8/4/21 9:14 PM, H. S. Teoh wrote:
Unless you have a specific reason to, avoid using `enum` with
string and
array literals, because they will trigger a memory allocation
*at every
single reference to them*, which is prob
On 8/4/21 9:14 PM, H. S. Teoh wrote:
Unless you have a specific reason to, avoid using `enum` with string and
array literals, because they will trigger a memory allocation *at every
single reference to them*, which is probably not what you want.
Just want to chime in and say this is NOT true fo
On Thursday, 5 August 2021 at 01:14:26 UTC, H. S. Teoh wrote:
1) If the constant is a POD (int, float, etc.), use:
enum myValue = ...;
crystal-clear.
2) If the constant is a string or some other array:
static immutable string myString = "...";
crystal-clear.
2) If the co
On Thu, Aug 05, 2021 at 12:47:06AM +, someone via Digitalmars-d-learn wrote:
> What are the pros/cons of the following approaches ?
1) If the constant is a POD (int, float, etc.), use:
enum myValue = ...;
2) If the constant is a string or some other array:
static immutable s
What are the pros/cons of the following approaches ?
```d
/// first day with D:
public const dstring gstrWhatever = "...";
/// next:
public immutable dstring gstrWhatever = "...";
/// next:
public immutable dstring gstrWhatever;
this() {
gstrWhatever = "...";
}
/// next (manifest-cons
23 matches
Mail list logo