On Monday, 20 August 2018 at 17:45:25 UTC, Seb wrote:
... yet. Though you can vote for this DIP and show your support
there:
https://github.com/dlang/DIPs/pull/71
It even comes with an implementation in DMD already:
https://github.com/dlang/dmd/pull/8460
How and where to vote?
On 08/20/2018 10:57 PM, Jonathan M Davis wrote:
Runtime reflection is theoretically possible in D, but it requires
generating the appropriate stuff for every type involved so that the runtime
stuff has something to work with. Java built all of that into the language
and has the JVM to boot, whic
On Monday, August 20, 2018 8:29:30 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> On 08/20/2018 04:34 PM, Jonathan M Davis wrote:
> > foreach(T; TypesThatVariantHolds)
>
> Yea, that's what I would've just done, but I wanted to support
> user-created types not already known
On 08/20/2018 04:34 PM, Jonathan M Davis wrote:
foreach(T; TypesThatVariantHolds)
Yea, that's what I would've just done, but I wanted to support
user-created types not already known to my library.
You
can't just call functions on completely unknown types, because the compiler
wouldn't
On Monday, 20 August 2018 at 23:24:04 UTC, Matthias Klumpp wrote:
On Monday, 20 August 2018 at 15:58:37 UTC, Jesse Phillips wrote:
[...]
There are a number of things out there, but personally don't
know there state or simplicity.
2016 there was a talk: http://dconf.org/2016/talks/nowak.html
On Monday, 20 August 2018 at 17:24:19 UTC, QueenSvetlana wrote:
I'm struggling to understand what the auto keyword is for and
it's appropriate uses. From research, it seems to share the
same capabilities as the var keyword in C#.
auto is one of the most misunderstood understood features in D
On Monday, 20 August 2018 at 15:58:37 UTC, Jesse Phillips wrote:
[...]
There are a number of things out there, but personally don't
know there state or simplicity.
2016 there was a talk: http://dconf.org/2016/talks/nowak.html
But personally I preferred this one:
http://dconf.org/2016/talks/
On Monday, 20 August 2018 at 19:36:15 UTC, werter wrote:
The code below doesn't work. Is it possible to make a pure
opEquals in a class?
[...]
pure bool opEquals(const A rhs) const
{
return b == rhs.b;
}
It doesn't work
On Monday, August 20, 2018 1:38:13 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> There are a bunch of discriminated union types available for D, but the
> only one I'm aware of that *doesn't* require a finite-sized list of
> types known ahead-of-time is Phobos's Variant. The o
For LDC, just rename your main() to WinMain().
Or alternatively, `-L/SUBSYSTEM:WINDOWS -L/ENTRY:mainCRTStartup`
in the LDC cmdline.
On 08/19/2018 11:31 PM, Paul Backus wrote:
You are basically reinventing OOP here.
Yes, I am. Deliberately, in fact. Class inheritance is my backup plan,
though.
My use-case is actually very, very similar to std.digest:
There are various benefits to using a template-and-constraint based
The code below doesn't work. Is it possible to make a pure
opEquals in a class?
void main()
{
class A
{
bool a;
int b;
this(bool g, int h)
{
a = g;
b =
On Monday, 20 August 2018 at 13:49:19 UTC, rikki cattermole wrote:
That is for Optlink not for MSVC link which ldc uses.
Exactly. For LDC, just rename your main() to WinMain().
Hi,
Given a package X, let us assume it's a library such that X = unit-
threaded, we find that in the ~/.dub/packages directory there is:
.dub/packages/unit-threaded-0.7.51/unit-threaded/gen_ut_main*
.dub/packages/unit-threaded-0.7.51/unit-threaded/libunit-threaded.a
These are the compilation pr
On Mon, 2018-08-20 at 15:58 +, Jesse Phillips via Digitalmars-d-
learn wrote:
> On Monday, 20 August 2018 at 02:30:16 UTC, binghoo dang wrote:
> > hi,
> >
> > I thinks D need an ORM library for Sqlite/Mysql/PostgreSQL,
> > entity currently support all the three targets, but entity's
> > API
On Monday, 20 August 2018 at 17:52:17 UTC, QueenSvetlana wrote:
Great!
So I can't declare class level variables with auto, correct?
only local method variables?
You can, globals, class members:
class Foo
{
auto bar = "hi";
}
Foo.bar will be of string type here, because "hi" is a string.
On Monday, 20 August 2018 at 17:52:17 UTC, QueenSvetlana wrote:
Great!
So I can't declare class level variables with auto, correct?
only local method variables?
You can use auto if you're setting the class level variable to a
default.
class X {
auto i = 42; // i will be an int
}
Great!
So I can't declare class level variables with auto, correct? only
local method variables?
On Monday, 20 August 2018 at 12:33:34 UTC, Andrey wrote:
On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote:
Create an overload of foo that takes two arguments and
combines them into a `Data` struct internally:
void foo(int a, string text)
{
Data data = {a, text};
foo(data);
On Monday, 20 August 2018 at 17:24:19 UTC, QueenSvetlana wrote:
I'm new to D programming, but have I have a background with
Python.
I'm struggling to understand what the auto keyword is for and
it's appropriate uses. From research, it seems to share the
same capabilities as the var keyword in
I'm new to D programming, but have I have a background with
Python.
I'm struggling to understand what the auto keyword is for and
it's appropriate uses. From research, it seems to share the same
capabilities as the var keyword in C#. From the C# documentation,
it states:
https://docs.micros
On Monday, 20 August 2018 at 16:27:55 UTC, Basile B. wrote:
Hello, it works fine here. Maybe there was another error that
you removed when you have minimized the example. See
https://run.dlang.io/is/ZrW7kI, that says that the example
works since 2.068.2. Although that are are possibility that i
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote:
Hello,
I want to make an alias to function "std.stdio.writeln" and
"std.stdio.write" and use it like:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? &writeln : &write;
_file.print();
text.pri
On Monday, 20 August 2018 at 16:16:04 UTC, Sebastiaan Koppe wrote:
Hey, I am trying to get UDAs from a doubly nested struct, to no
avail:
code
---
import std.traits : hasUDA;
enum hover;
struct Style {
struct Root {
auto margin = "10px";
auto backgroundColor = "white";
@hover str
Hey, I am trying to get UDAs from a doubly nested struct, to no
avail:
code
---
import std.traits : hasUDA;
enum hover;
struct Style {
struct Root {
auto margin = "10px";
auto backgroundColor = "white";
@hover struct Hover {
auto backgroundColor = "gray";
}
}
}
pragma(
On Monday, 20 August 2018 at 13:35:07 UTC, ag0aep6g wrote:
On 08/20/2018 03:14 PM, Andrey wrote:
Thanks everybody for your answers.
On Monday, 20 August 2018 at 02:30:16 UTC, binghoo dang wrote:
hi,
I thinks D need an ORM library for Sqlite/Mysql/PostgreSQL,
entity currently support all the three targets, but entity's
API is too complex and cumbersome for using.
Is there a more light-weight and simpler implementation lik
On 21/08/2018 1:42 AM, spikespaz wrote:
I am trying to add a *.def file to my program to hide the console window
on launch, as it doesn't need to display anything to function. It is a
Windows only application.
I saw at this post
(https://forum.dlang.org/post/ilj5vn$ef4$1...@digitalmars.com) t
On Monday, 20 August 2018 at 13:42:58 UTC, spikespaz wrote:
I am trying to add a *.def file to my program to hide the
console window on launch, as it doesn't need to display
anything to function. It is a Windows only application.
[...]
Also adding that the linker flag I have stated above als
I am trying to add a *.def file to my program to hide the console
window on launch, as it doesn't need to display anything to
function. It is a Windows only application.
I saw at this post
(https://forum.dlang.org/post/ilj5vn$ef4$1...@digitalmars.com) that
I could either use a linker flag, -L
On 08/20/2018 03:14 PM, Andrey wrote:
Hello,
I want to make an alias to function "std.stdio.writeln" and
"std.stdio.write" and use it like:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? &writeln : &write;
_file.print();
text.print();
}
Unfortuna
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote:
Hello,
I want to make an alias to function "std.stdio.writeln" and
"std.stdio.write" and use it like:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? &writeln : &write;
_file.print();
text.pri
On Monday, 20 August 2018 at 13:22:02 UTC, Andrey wrote:
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote:
Mistake... this is:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? &writeln : &write;
_file.print(text);
text.print();
}
static void lo
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote:
Mistake... this is:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? &writeln : &write;
_file.print(text);
text.print();
}
On Monday, 20 August 2018 at 12:33:34 UTC, Andrey wrote:
On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote:
Create an overload of foo that takes two arguments and
combines them into a `Data` struct internally:
void foo(int a, string text)
{
Data data = {a, text};
foo(data);
Hello,
I want to make an alias to function "std.stdio.writeln" and
"std.stdio.write" and use it like:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? &writeln : &write;
_file.print();
text.print();
}
Unfortunately, it doesn't work... Also tried wit
On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote:
Create an overload of foo that takes two arguments and combines
them into a `Data` struct internally:
void foo(int a, string text)
{
Data data = {a, text};
foo(data);
}
Hmm, not very good solution. In C++ you can not to wri
On Monday, 20 August 2018 at 09:23:27 UTC, Andrey wrote:
Hello,
I have a function and a struct:
void foo(ref Data data) { ... }
struct Data
{
int a;
string text;
}
How to pass struct into function without naming its type?
This doesn't work:
foo({1234, "Hello!"});
Create an overl
On Monday, August 20, 2018 4:29:56 AM MDT Andrey via Digitalmars-d-learn
wrote:
> On Monday, 20 August 2018 at 09:56:13 UTC, Jonathan M Davis wrote:
> > It's a combination of keeping the C semantics (in general, C
> > code is valid D code with the same semantics, or it won't
> > compile) and the f
On Monday, 20 August 2018 at 09:56:13 UTC, Jonathan M Davis wrote:
It's a combination of keeping the C semantics (in general, C
code is valid D code with the same semantics, or it won't
compile) and the fact that D requires casts for narrowing
conversions. When you add two shorts in C/C++, it c
On Monday, August 20, 2018 3:19:04 AM MDT Andrey via Digitalmars-d-learn
wrote:
> On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote:
> > Yes. On x86 int's will be faster just an FYI so it does make
> > sense to use them for computation.
>
> Inconveniently always use casts. Why in D
On 20/08/2018 9:19 PM, Andrey wrote:
On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote:
Yes. On x86 int's will be faster just an FYI so it does make sense to
use them for computation.
Inconveniently always use casts. Why in D one decided to do in such way?
C.
Hello,
I have a function and a struct:
void foo(ref Data data) { ... }
struct Data
{
int a;
string text;
}
How to pass struct into function without naming its type?
This doesn't work:
foo({1234, "Hello!"});
On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote:
Yes. On x86 int's will be faster just an FYI so it does make
sense to use them for computation.
Inconveniently always use casts. Why in D one decided to do in
such way?
On 20/08/2018 8:48 PM, Andrey wrote:
On Monday, 20 August 2018 at 08:42:20 UTC, rikki cattermole wrote:
It's called integer promotion and it originates from C.
And yes C++ does have such support in some variant (I really don't
feel like comparing the two).
And I should do? Always use "cast" o
On Monday, 20 August 2018 at 08:42:20 UTC, rikki cattermole wrote:
It's called integer promotion and it originates from C.
And yes C++ does have such support in some variant (I really
don't feel like comparing the two).
And I should do? Always use "cast" operator when I operate not
with ints?
On 20/08/2018 8:34 PM, Andrey wrote:
Hello,
Here is a code that you can execute using online compiler
https://run.dlang.io/:
import std.stdio;
void main()
{
ushort first = 5;
ushort second = 1000;
ushort result = first + second;
writeln(result);
}
I hae this error:
onlineapp.d
Hello,
Here is a code that you can execute using online compiler
https://run.dlang.io/:
import std.stdio;
void main()
{
ushort first = 5;
ushort second = 1000;
ushort result = first + second;
writeln(result);
}
I hae this error:
onlineapp.d(7): Error: cannot implicitly convert
48 matches
Mail list logo