On Wednesday, 3 August 2022 at 03:36:55 UTC, Domain wrote:
I want to find out all public functions in all modules in a
package. Can I do that at compile time?
I think it's not possible.
On Friday, 6 November 2020 at 10:51:20 UTC, Andrey Zherikov wrote:
struct Result(T)
{
struct Success
{
static if(!is(T == void))
{
T value;
}
}
struct Failure
{
string error;
}
Algebraic!(Success, Failure) result;
On Sunday, 22 December 2019 at 17:20:51 UTC, BoQsc wrote:
There are lots of editors/IDE's that support D language:
https://wiki.dlang.org/Editors
What kind of editor/IDE are you using and which one do you like
the most?
IntelliJ IDEA CE with this extension:
On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis
wrote:
Not being able to implicitly convert to const is a bit odd, but
arguably, nothing should ever be called on a shared AA anyway.
If an operation isn't thread-safe, then it shouldn't work with
shared. To use a shared object
Code:
import std;
shared(string[string]) dict;
void main()
{
dict.keys;
}
Error:
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(3417):
Error: cannot implicitly convert expression aa of type
shared(string[string]) to const(shared(string)[string])
onlineapp.d(7): Error:
On Saturday, 6 October 2018 at 13:17:22 UTC, bauss wrote:
Let's say you have a range with struct, but some of the struct
are duplicates of each other.
Is there a standard function in Phobos to remove duplicates?
My first thought was "uniq", but it can't really do it like
that, but it doesn't
This code:
import std.stdio;
class X1 {}
class X2 : X1
{
void run() @safe
{
writeln("DONE");
}
}
void main() @safe
{
X1 x1 = new X1;
X2 x2 = cast(X2) x1;
x2.run();
}
is obviously wrong gets killed by
On Tuesday, 10 July 2018 at 13:24:43 UTC, WebFreak001 wrote:
It's supposed to make webservers safe and not crash because of
segmentation faults, etc.
If you still want to write code like you are used to and don't
care about that in your webserver, just mark everything in the
implementation
Hello,
I've recently started building a little REST application on
vibe.d. I decided to use the "database" library, as I need to
communicate with the PostgreSQL instance.
During the compilation I see the deprecation warning:
"Non-@safe methods are deprecated in REST interfaces"
So two
On Thursday, 17 May 2018 at 02:32:07 UTC, KingJoffrey wrote:
I propose an idea, for discussion (robust discussion even
better ;-)
Add an new attribute to class, named 'sealed'.
No, not sealed as in Scala.
No, not sealed as in C#
sealed as in oxford dictionary (close securely, non-porous).
On Saturday, 12 May 2018 at 15:36:56 UTC, Walter Bright wrote:
On 5/12/2018 8:18 AM, Piotr Mitana wrote:
What I am trying to do is:
== a.d
class P
{
private this();
}
final class C1 : P { }
final class C2 : P { }
test.d
import a;
void foo()
On Saturday, 12 May 2018 at 10:27:11 UTC, Walter Bright wrote:
The solution is:
private class MyClass { ... }
public final MyClassSealed : MyClass { }
Meaning other modules can use MyClassSealed but cannot derive
from it. Other classes inside the module can derive from
MyClass as
On Friday, 11 May 2018 at 23:28:48 UTC, Jonathan M Davis wrote:
Except that if I understand correctly, what the OP wants is to
have the class be publicly available while restricting who's
allowed to derive from it, with the idea that a particular
class hierarchy would have a well-defined set
On Friday, 11 May 2018 at 15:02:08 UTC, jmh530 wrote:
But a new keyword will not get added without a DIP.
Yes, I know it definitely needs a DIP - I've opened a discussion
in order to gather community members' opinions on sealed and
decide whether to write this DIP at all and possibly track
Might I suggest going back to the sealed classes topic? I don't
think the discussion in this thread should go in the direction
about the sense of using classes, proper encapsulation and the
memory related stuff.
On Thursday, 10 May 2018 at 14:48:23 UTC, rikki cattermole wrote:
module foo;
class A { }
final class B : A { }
in one module, he wants to be able to create a new
final class C : B { }
and keep class B as final so that no one else can extend it in
another module.
Not entirely.
Hello,
I've recently thought of sealed classes (sealed as in Scala, not
as in C#) and am thinking of writing a DIP for it. I decided to
start this thread first though to gather some opinions on the
topic.
For those who never coded Scala and don't know sealed classes: a
sealed class is a
Given this code:
abstract class A
{
package @property void x(int x);
package @property int x();
}
class B : A
{
package @property override void x(int x) {}
package @property override int x() { return 0; }
}
void main() {}
I get the following message:
onlineapp.d(9): Error:
For some reason this is true:
slide!(Yes.withPartial)([1, 2, 3, 4, 5], 3).array == [[1, 2, 3],
[2, 3, 4], [3, 4, 5]]
Shouldn't it rather return [[1], [1, 2], [1, 2, 3], [2, 3, 4],
[3, 4, 5], [4, 5], [5]], or at least [[1, 2, 3], [2, 3, 4], [3,
4, 5], [4, 5], [5]]?
I can see no difference
Hello,
The code below:
import std.traits;
enum Attr;
class MyClass
{
private @Attr int a;
static assert(getSymbolsByUDA!(typeof(this), MyClass).length
== 1);
}
does not compile as static assertion fails. Making the filed a
public makes it compile
Hello,
I'd like to make a little suggestion for phobos: enrich
findSplit* method family with the "needleless" predicate option.
Motivation:
Let's have a range of string tokens that - after cutting of the
initial brace - looks like this:
auto range = ["23", "42", "14.3", "-323", "}"]
Code:
===
import std.conv;
import std.regex;
struct A
{
int field1;
int field2;
this(int field1, int field2)
{
if(field1 > field2)
throw new Exception("This is illegal!");
}
Hello, I have this code:
immutable class Base
{
this() {}
}
immutable class Derived : Base {}
void main()
{
new immutable Derived();
}
I'd like class Derived to automatically inherit the default
constructor from Base. However, this is not the case:
main.d(6): Error: class
On Monday, 8 May 2017 at 20:05:01 UTC, Joseph Rushton Wakeling
wrote:
Hello all,
As announced at DConf 2017, snap packages are now available for
DMD 2.074.0 and DUB 1.3.0 in the official snap store. These
should allow for installation on multiple different Linux
distros (see below) on i386
On Monday, 8 May 2017 at 20:05:01 UTC, Joseph Rushton Wakeling
wrote:
Hello all,
As announced at DConf 2017, snap packages are now available for
DMD 2.074.0 and DUB 1.3.0 in the official snap store. These
should allow for installation on multiple different Linux
distros (see below) on i386
25 matches
Mail list logo