I’d like to know if constructors of classes and structs can have
type inference. So far, I am using a separate function for this
purpose, for example:
```
import std.stdio: writeln;
struct Pair(T, U)
{
T first;
U second;
this(T first, U second)
{
this.first = first;
On Thu, Sep 17, 2020 at 09:53:07PM -0400, James Blachly via Digitalmars-d-learn
wrote:
[...]
> I never considered this -- so when I call core.stdc.stdlib : exit,
> none of my destructors get called?
Yes.
> Presumably also not scope(exit) blocks?
Yes.
> If this is the case, could we simply
On Thursday, 17 September 2020 at 22:25:47 UTC, claptrap wrote:
If enum means manifiest constant, or compile time constant,
then it makes more sense, as you allude to in a later post. But
'enum' is a terrible name for that and I dont think my brain
will ever stop finding it incongruous.
And
On 9/17/20 12:46 PM, IGotD- wrote:
The only way is to return from main. The thing is that druntime runs
initialization before main and then returning from main it runs all the
tear down code including cleaning up the GC. This means there is no
equivalent of the exit function in the C library.
On Thursday, 17 September 2020 at 10:53:48 UTC, Mike Parker wrote:
[snip]
I can attest that in the 17 years I've been hanging around
here, the fact that enum is used to indicate a manifest
constant has not been a serious source of WTF posts. So I think
"pretty much everyone coming to D" have
On Thursday, 17 September 2020 at 22:33:46 UTC, Steven
Schveighoffer wrote:
On 9/17/20 6:13 PM, aberba wrote:
On Thursday, 17 September 2020 at 21:57:37 UTC, Steven
Schveighoffer wrote:
On 9/17/20 1:08 PM, wjoe wrote:
[...]
the `files` property actually does the processing only when
you
On Thursday, 17 September 2020 at 22:07:54 UTC, Simen Kjærås
wrote:
Usually, that would be:
struct V {
int x;
mixin assign!"+" a;
mixin assign!"-" b;
alias opOpAssign = a.opOpAssign;
alias opOpAssign = b.opOpAssign;
}
However, I can't seem to get that working. It seems to
On 9/17/20 6:13 PM, aberba wrote:
On Thursday, 17 September 2020 at 21:57:37 UTC, Steven Schveighoffer wrote:
On 9/17/20 1:08 PM, wjoe wrote:
[...]
the `files` property actually does the processing only when you call it.
If you access the `bodyReader` property directly, you can process that
On Thursday, 17 September 2020 at 10:56:28 UTC, Mike Parker wrote:
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote:
Seriously how it's implemented is irrelevant.
And to be clear, my point wasn't about how it's implemented. My
point was that:
enum { foo = 10; }
and
enum
On Thu, Sep 17, 2020 at 06:06:56PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 9/17/20 9:13 AM, Simen Kjærås wrote:
>
> > To be clear: I don't mind 'enum' being used this way, but if I were
> > to do things over again, I would have used 'alias'.
>
> fun fact: for a (very)
On Thursday, 17 September 2020 at 21:57:37 UTC, Steven
Schveighoffer wrote:
On 9/17/20 1:08 PM, wjoe wrote:
[...]
the `files` property actually does the processing only when you
call it.
If you access the `bodyReader` property directly, you can
process that data yourself. You can even
On 9/17/20 9:13 AM, Simen Kjærås wrote:
To be clear: I don't mind 'enum' being used this way, but if I were to
do things over again, I would have used 'alias'.
fun fact: for a (very) brief time, D had a `manifest` keyword that did
exactly what enum does in this instance (not even sure it
On Thursday, 17 September 2020 at 21:05:59 UTC, 60rntogo wrote:
struct V
{
int x;
mixin assign!"+";
// mixin assign!"-";
}
However, if I uncomment the second mixin, there is an error "v
is not a scalar, it is a V". I guess I somehow need to merge
these overloads, but I don't know how.
On 9/17/20 1:08 PM, wjoe wrote:
Every post or example I found copies the file, like your code does, too.
Why is that ? The content of the file upload is embedded in the form
data. There's no need for temporary files or copying at all.
On top of that, if I upload a file to a server which is on
I suspect that this is similar to the issue I asked about here:
https://forum.dlang.org/post/vukxaqprjbyrdpiou...@forum.dlang.org, but I can't figure it out.
This compiles:
---
private mixin template assign(string op_)
{
ref auto opOpAssign(string op, this RHS)(RHS rhs) if (op == op_)
{
On Thu, Sep 17, 2020 at 08:40:06PM +, wjoe via Digitalmars-d-learn wrote:
> On Thursday, 17 September 2020 at 19:27:41 UTC, Adam D. Ruppe wrote:
> > fyi my baby was just born i'll come back to this but it might be a
> > day or two
[...]
"A day or two"??! More likely a month for starters. :-D
On Thursday, 17 September 2020 at 19:27:41 UTC, Adam D. Ruppe
wrote:
fyi my baby was just born i'll come back to this but it might
be a day or two
congratulations! All the best for your family :)
On Thursday, 17 September 2020 at 16:32:55 UTC, WebFreak001 wrote:
On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote:
I found this [1] but unfortunately the post this refers to is
a dead link and the content, unfortunately, didn't tell me
anything that I didn't already find in the
fyi my baby was just born i'll come back to this but it might be
a day or two
On Thursday, 17 September 2020 at 09:53:57 UTC, Remi wrote:
[snip]
My problem here is mostly understanding the __initZ symbol and
where it comes from. I mostly want classes and the bare minimum
of std like you did for Tetris in WebAssembly for example. My
project is OpenGL/SDL2 so there's a
On Thursday, 17 September 2020 at 18:29:12 UTC, bauss wrote:
Does vibe.d not work properly with ex. mp4 files?
I have a consistent issues that it will only play part of video
files in the browser.
As if it won't "stream" the rest of the video.
Is that a problem with vibe.d or is it some
Does vibe.d not work properly with ex. mp4 files?
I have a consistent issues that it will only play part of video
files in the browser.
As if it won't "stream" the rest of the video.
Is that a problem with vibe.d or is it some configuration that
needs to be enabled?
On Thursday, 17 September 2020 at 16:32:55 UTC, WebFreak001 wrote:
On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote:
I found this [1] but unfortunately the post this refers to is
a dead link and the content, unfortunately, didn't tell me
anything that I didn't already find in the
On Thursday, 17 September 2020 at 14:58:48 UTC, drathier wrote:
What's the proper way to exit with a specific exit code?
I found a bunch of old threads discussing this, making sure
destructors run and the runtime terminates properly, all of
which seemingly concluding that it's sad that there
On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote:
I found this [1] but unfortunately the post this refers to is a
dead link and the content, unfortunately, didn't tell me
anything that I didn't already find in the docs.
What I can get from the form is the form fields with content,
I found this [1] but unfortunately the post this refers to is a
dead link and the content, unfortunately, didn't tell me anything
that I didn't already find in the docs.
What I can get from the form is the form fields with content, the
field name for the file upload and the file name. But the
On Thu, Sep 17, 2020 at 02:58:48PM +, drathier via Digitalmars-d-learn
wrote:
> What's the proper way to exit with a specific exit code?
>
> I found a bunch of old threads discussing this, making sure
> destructors run and the runtime terminates properly, all of which
> seemingly concluding
What's the proper way to exit with a specific exit code?
I found a bunch of old threads discussing this, making sure
destructors run and the runtime terminates properly, all of which
seemingly concluding that it's sad that there isn't a way to do
this easily, but hopefully things have changed
On Thursday, 17 September 2020 at 13:25:08 UTC, Mike Parker wrote:
Well, I was already using anonymous enums for compile-time
And, I should add, I have *never* seen C enums as an enumerated
list of values. I've always seen them as an alternative for
#defined constants because they're
On Thursday, 17 September 2020 at 13:13:46 UTC, Simen Kjærås
wrote:
To quote Bill Baxter from way back when
(https://forum.dlang.org/post/fjdc4c$2gft$1...@digitalmars.com):
> Why does:
> final int x = 3;
> make any more intuitive sense than:
> enum int x = 3;
> ?
There are these
On Thursday, 17 September 2020 at 10:56:28 UTC, Mike Parker wrote:
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote:
Seriously how it's implemented is irrelevant.
And to be clear, my point wasn't about how it's implemented. My
point was that:
enum { foo = 10; }
and
enum
On Thursday, 17 September 2020 at 04:01:11 UTC, Adam D. Ruppe
wrote:
On Thursday, 17 September 2020 at 03:06:45 UTC, realhet wrote:
Anyone can help me telling how to decode these please?
Just prepend
_D4name
Thank you very much!
On Thursday, 17 September 2020 at 10:56:28 UTC, Mike Parker wrote:
Are effectively the same thing, whether it's implemented that
way or not. So why on earth would a new keyword be necessary?
C++ made enums stricter by "enum class".
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote:
Seriously how it's implemented is irrelevant.
And to be clear, my point wasn't about how it's implemented. My
point was that:
enum { foo = 10; }
and
enum foo = 10;
Are effectively the same thing, whether it's implemented
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote:
Names are important, principle of least astonishment and all
that, pretty much everyone coming to D is going be WTF in
learning about that. And if you keep overloading existing
keywords with more and more meanings the code gets
https://forum.dlang.org/post/nnxbwdypwepymgerz...@forum.dlang.org
On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote:
Hi,
I would like to know how to specify dmd or ldc compiler and
version in a json dub file.
Thanks in advance.
https://dub.pm/settings.html
On Wednesday, 16 September 2020 at 18:34:05 UTC, Adam D. Ruppe
wrote:
On Wednesday, 16 September 2020 at 17:59:41 UTC, Remi wrote:
I tried to modify the hello.d example from your blog post. It
works without changes but when I tried to do a string
concatenation
Yeah, concatenation is one of
On Thursday, 17 September 2020 at 01:57:39 UTC, Mike Parker wrote:
On Thursday, 17 September 2020 at 00:32:40 UTC, Cecil Ward
enum foo is essentially a shortcut for enum { foo }. It’s
neither bent out of shape nor twisted. Consider that C++ added
the new keyword constexpr for the same thing.
On Tuesday, 8 September 2020 at 08:41:24 UTC, glis-glis wrote:
Following the advice of drug, I moved the "tools" folder from
src to the parent directory, added a dependency to "biophysics"
with path ".." and build the binaries with "dub build --single
tools/..."
This works fine, however,
39 matches
Mail list logo