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,
On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote:
file test.d:
-
module test;
import abc;
void doTest(){
log!"test"();
}
---
file abc.d:
-
module abc;
import test;
void log(string fmt, int line =
On 8/4/21 10:27 PM, Ali Çehreli wrote:
I wonder whether this feature is thanks to 'lazy' parameters, which are
actually delegates.
No, the default parameters are used directly as if they were typed in at
the call site (more or less, obviously the `__FILE__` example is weird).
So:
```d
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
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
On 8/4/21 7:17 PM, Steven Schveighoffer wrote:
>> The compiler has to evaluate the default argument as constant
>> expression in order to use it as default value..
>
> This is not true, you can use runtime calls as default values.
What??? I just checked and it works! :)
string bar() {
On Thursday, 5 August 2021 at 01:47:36 UTC, Alexandru Ermicioi
wrote:
On Wednesday, 4 August 2021 at 22:28:53 UTC, someone wrote:
Is that what you mean ?
Not really. I was assuming you were talking about @property
methods, and if so you could declare such cases:
```
interface
On 7/26/21 1:05 PM, Stefan Koch wrote:
On Monday, 26 July 2021 at 12:01:23 UTC, Adam D Ruppe wrote:
On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote:
__FILE__[0..$]
Why do you have that [0..$] there? It is probably breaking the
__FILE__ magic.
Correct.
The compiler has to evaluate
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
On Wednesday, 4 August 2021 at 22:28:53 UTC, someone wrote:
Is that what you mean ?
Not really. I was assuming you were talking about @property
methods, and if so you could declare such cases:
```
interface HasMutableLstrSymbolId {
@property lstrSymbolId();
@property lstrSymbolId(string
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
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
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
On Wednesday, 4 August 2021 at 22:22:29 UTC, Adam D Ruppe wrote:
On Wednesday, 4 August 2021 at 22:01:21 UTC, someone wrote:
No. I didn't know it ever existed :(
It is good to look at the source code implementations of some
of those things too. Most are built out of language features
and
On Wednesday, 4 August 2021 at 16:41:04 UTC, Alexandru Ermicioi
wrote:
Since you're using classes consider just declaring an interface
that denotes that implementor has this field, it would be much
easier to check for it, and easier for compiler since it avoids
compile time magic.
I am not
On Wednesday, 4 August 2021 at 22:01:21 UTC, someone wrote:
No. I didn't know it ever existed :(
It is good to look at the source code implementations of some of
those things too. Most are built out of language features and
some of it is simpler to use directly (and some of it are pretty
On Wednesday, 4 August 2021 at 16:41:04 UTC, Alexandru Ermicioi
wrote:
On Wednesday, 4 August 2021 at 15:08:24 UTC, someone wrote:
However, __traits(hasMember, ...) checks for the existence of
anything labeled lstrCurrencyID within the class (eg:
unrelated variables with same name; not gonna
On Wednesday, 4 August 2021 at 20:13:53 UTC, Steven Schveighoffer
wrote:
On 8/4/21 11:08 AM, someone wrote:
Have you looked at
[std.traits](https://dlang.org/phobos/std_traits.html) at all?
It does a lot of stuff, including giving you parameter names
and types.
No. I didn't know it ever
On Wednesday, 4 August 2021 at 05:01:59 UTC, Ali Çehreli wrote:
On 8/3/21 9:51 PM, Brian Tiffin wrote:
...
> Is there a go to quick and easy way of tracking down
> module members?
Searching for it at dlang.org usually works pretty well.
Although, I hear that Adam's Phobos documentation site
On Wednesday, 4 August 2021 at 20:24:28 UTC, SealabJaster wrote:
..
Oops, please ignore, put it into lflags instead of dflags
On Wednesday, 4 August 2021 at 19:47:42 UTC, Paul Backus wrote:
...
I am now getting this error:
```
/usr/bin/ld: -f may not be used without -shared
```
Adding -shared:
```
/usr/bin/ld:
.dub/build/test-debug-linux.posix-x86_64-dmd_v2.097.1-3DC2262935789AAE4203853EDDD1C5A4/libd.o:
On 8/4/21 11:08 AM, someone wrote:
However, __traits(hasMember, ...) checks for the existence of anything
labeled lstrCurrencyID within the class (eg: unrelated variables with
same name; not gonna happen, but, I like to code it the right way); so,
question is: is there any way to search the
On Wednesday, 4 August 2021 at 09:41:45 UTC, Mathias LANG wrote:
On Wednesday, 4 August 2021 at 04:51:48 UTC, Brian Tiffin wrote:
With `import std.json` working for the other symbols like
parseJSON?
`gdc-11 (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0`
Have good.
You are using GDC 11, which has
On Wednesday, 4 August 2021 at 18:52:40 UTC, SealabJaster wrote:
However, I'm now running into the following linker error that I
really don't know what to do with:
```
/usr/bin/ld:
.dub/build/test-debug-linux.posix-x86_64-dmd_v2.097.1-6FDCEE655D96859081886B42E500F838/libd.o: relocation
On Wednesday, 4 August 2021 at 18:52:40 UTC, SealabJaster wrote:
...
Forgot to mention: Build with `dub run --compiler=dmd -c test`
I'm currently working on a libc-less standard library for myself,
and was working on Posix support recently.
However, I'm now running into the following linker error that I
really don't know what to do with:
```
/usr/bin/ld:
On Wednesday, 4 August 2021 at 15:08:24 UTC, someone wrote:
However, __traits(hasMember, ...) checks for the existence of
anything labeled lstrCurrencyID within the class (eg: unrelated
variables with same name; not gonna happen, but, I like to code
it the right way); so, question is: is
I have the following chunk of code that needs to conditionally
instantiate existing classes (at compilation time) named
classTickerCustom{ExchangeID} with one or ... two parameters (if
any); eg:
```d
/// securities trading on exchange primary currency; eg: USD
... = new
On 8/4/21 4:18 AM, evilrat wrote:
On Wednesday, 4 August 2021 at 07:21:56 UTC, Denis Feklushkin wrote:
On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote:
vibe-d - probably because it handles DB connection and/or keep things
async way, sure you probably can do it with Phobos but it will
On Wednesday, 4 August 2021 at 08:18:34 UTC, evilrat wrote:
Than again like I said it is library author mistake, if only
JSON is ever used then it should depend on vibe-d:data
specifically and not the whole vibe-d thing.
It is also a problem with dub though since D, the language,
supports
On Wednesday, 4 August 2021 at 04:51:48 UTC, Brian Tiffin wrote:
With `import std.json` working for the other symbols like
parseJSON?
`gdc-11 (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0`
Have good.
You are using GDC 11, which has an older version of the frontend.
GDC is pretty great for
On Tuesday, 3 August 2021 at 00:54:56 UTC, Steven Schveighoffer
wrote:
Given the way D works, and often template-heavy coding styles,
I think it's going to be hard to do this correctly, without
careful attention and lots of `version(has_xxx)` conditionals.
-Steve
I don't think optional
On Wednesday, 4 August 2021 at 07:21:56 UTC, Denis Feklushkin
wrote:
On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote:
vibe-d - probably because it handles DB connection and/or keep
things async way, sure you probably can do it with Phobos but
it will be much more PITA and less
On Sunday, 1 August 2021 at 17:18:39 UTC, Alain De Vos wrote:
A simple and small wrapper around for instance the C-library
Really, dpq2 is that wrapper
On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote:
vibe-d - probably because it handles DB connection and/or keep
things async way, sure you probably can do it with Phobos but
it will be much more PITA and less performant
It is because Postgres provides JSON types
On Wednesday, 4 August 2021 at 05:01:59 UTC, Ali Çehreli wrote:
On 8/3/21 9:51 PM, Brian Tiffin wrote:
> I added an `import std.json;`. That did not include the
> JSONType enum.
It works for me:
import std.json;
int main() {
return JSONType.null_;
}
> Is there a go to quick and easy way
On 02.08.21 22:14, vit wrote:
Why this doesn't work:
```d
template DestructorType(T){
alias Get(T) = T;
alias DestructorType = Get!(typeof((void*){
T tmp;
}));
}
struct Foo{
~this()@safe{}
}
```
```d
void main(){
//Error: static assert: `is(void
On Wednesday, 4 August 2021 at 01:10:15 UTC, Mike Parker wrote:
On Tuesday, 3 August 2021 at 21:40:09 UTC, james.p.leblanc
wrote:
[...]
The alias to Complex!double is a template instantiation. A
template instantiation creates a symbol that needs to be
linked. So you need to compile
40 matches
Mail list logo