Is there any idiomatic undo designs in D that give a more natural
implementation than the standard techniques?
On Wednesday, 20 June 2018 at 12:08:28 UTC, Jonathan M Davis
wrote:
On Wednesday, June 20, 2018 11:43:52 DigitalDesigns via
Digitalmars-d wrote:
alias f = void delegate();
Tuple!(f)[] fs;
fs ~= tuple(() { });
fails but
fs ~= Tuple!(f)(() { });
passes.
in tuple, it is seeing the lambda
alias f = void delegate();
Tuple!(f)[] fs;
fs ~= tuple(() { });
fails but
fs ~= Tuple!(f)(() { });
passes.
in tuple, it is seeing the lambda as void and thinks I'm trying
to append a tuple of void. I don't see why the compiler can't see
that it works.
On Tuesday, 19 June 2018 at 12:44:26 UTC, Nicholas Wilson wrote:
On Tuesday, 19 June 2018 at 08:40:03 UTC, DigitalDesigns wrote:
There needs to be a switch, if their isn't one already, where
only errors are verbose.
When I use the -v switch it not only expands the error trace
like it should
There needs to be a switch, if their isn't one already, where
only errors are verbose.
When I use the -v switch it not only expands the error trace like
it should but also adds all kinds of additional meaningless
info(semantic3, module list, etc). All this additional
information is generally
On Monday, 18 June 2018 at 21:47:01 UTC, Steven Schveighoffer
wrote:
On 6/18/18 5:27 PM, Walter Bright wrote:
On 6/18/2018 3:54 AM, Timon Gehr wrote:
The code you linked to does it. :)
I know. But it shouldn't. Do as I say, not as I do :-)
I don't see how you misuse the symbols.
I think
On Sunday, 17 June 2018 at 22:55:57 UTC, Walter Bright wrote:
On 6/15/2018 11:08 PM, DigitalDesigns wrote:
When an identifier starts with __, allMembers does not return
it. This is very bad behavior! It can silently create huge
problems if the programmer is not aware of the bug.
It's not a
On Sunday, 17 June 2018 at 02:29:12 UTC, Adam D. Ruppe wrote:
On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote:
I need to get the protected and private members for
serialization.
This breaks encapsulation.
A better design would be to have a class know how to serialize
itself
On Saturday, 16 June 2018 at 23:33:13 UTC, Jonathan M Davis wrote:
On Saturday, June 16, 2018 22:59:24 DigitalDesigns via
Digitalmars-d wrote:
On Saturday, 16 June 2018 at 06:47:59 UTC, Jonathan M Davis
wrote:
> On Saturday, June 16, 2018 06:08:17 DigitalDesigns via
>
> Digitalmar
On Saturday, 16 June 2018 at 21:41:37 UTC, Jonathan M Davis wrote:
On Saturday, June 16, 2018 14:55:51 Steven Schveighoffer via
Digitalmars-d- learn wrote:
On 7/30/16 8:47 AM, Jonathan M Davis via Digitalmars-d-learn
wrote:
> I'm writing some serialization code where I need to skip
> static
On Saturday, 16 June 2018 at 06:47:59 UTC, Jonathan M Davis wrote:
On Saturday, June 16, 2018 06:08:17 DigitalDesigns via
Digitalmars-d wrote:
When an identifier starts with __, allMembers does not return
it. This is very bad behavior! It can silently create huge
problems if the programmer
On Saturday, 30 July 2016 at 13:04:56 UTC, Ali Çehreli wrote:
On 07/30/2016 05:47 AM, Jonathan M Davis via
Digitalmars-d-learn wrote:
> I'm writing some serialization code where I need to skip
static variables.
> So, I have a symbol from a struct, and I'd like to test
whether it's static
> or
mixin(`foo!(typeof(T.`~m~`));
gives me an error about m being protected.
Error: class `X` member `name` is not accessible.
this also happens when using __traits(getMember, T, m); X is in
another module. Works fine when X is in the same module.
I need to get the protected and private members
On Saturday, 16 June 2018 at 07:56:22 UTC, Bauss wrote:
On Saturday, 16 June 2018 at 05:05:19 UTC, DigitalDesigns wrote:
tupleof does not return static fields as does not Fields.
Currently the only method seems to be use allMembers, but that
returns members requiring filtering, which there is
When an identifier starts with __, allMembers does not return it.
This is very bad behavior! It can silently create huge problems
if the programmer is not aware of the bug.
Instead, if you want to keep the current behavior at least create
an error or warning rather than silently create a bug
tupleof does not return static fields as does not Fields.
Currently the only method seems to be use allMembers, but that
returns members requiring filtering, which there is no good
filtering checks. I'd simply like to get all the fields of a
type, static and non-static.
Does ranges have the ability to store a temp value in a "range
like way" that can be used later?
The idea is to avoid having to create temp variables. A sort of
range with "memory"
On Saturday, 16 June 2018 at 00:34:01 UTC, H. S. Teoh wrote:
On Sat, Jun 16, 2018 at 12:24:42AM +, DigitalDesigns via
Digitalmars-d wrote:
space is ignored! Seems like a bug std . traits . std . string
is valid?
It's not a bug. The '.' is the member-access operator, and
like all other
space is ignored! Seems like a bug std . traits . std . string is
valid?
On Friday, 15 June 2018 at 23:04:40 UTC, Sjoerd Nijboer wrote:
For someone coming from a C# background there is some seemingly
simple syntactic sugar missing from D.
* The null conditional operator `?.`
* Something like a `yield return` statement for coroutines.
T* he `async` & `await` keyword
On Friday, 15 June 2018 at 04:19:28 UTC, Vladimir Panteleev wrote:
On Friday, 15 June 2018 at 03:54:34 UTC, DigitalDesigns wrote:
So, it should be very important to have some type of info that
connects the error to what the compiler was doing. With large
problems it is not easy to reduce to a
On Friday, 15 June 2018 at 02:47:56 UTC, Jonathan M Davis wrote:
On Friday, June 15, 2018 02:31:49 DigitalDesigns via
Digitalmars-d wrote:
> I am getting the compiler to crash from a different problem
> after I moved some files around. I have no idea where the
> err
I am getting the compiler to crash from a different problem
after I moved some files around. I have no idea where the error
is now.
There was a module that was included that was crashing the
compiler for some reason. When I removed it, which wasn't part of
the original project the compiler
On Thursday, 14 June 2018 at 12:12:34 UTC, Timon Gehr wrote:
On 14.06.2018 13:30, DigitalDesigns wrote:
All I know is that using the code
static foreach(a; ["wchar", "ushort"])
mixin("void bar("~a~" value) { foo(); }");
is what is causing it. Manually giving the functions works
fine.
object.Error@(0): Access Violation
0x00415999
0x0040A3B7
0x00518A2D
0x005751FD
0x005ABA41
0x005ABAEB
0x00525136
0x005246D6
0x005253E2
0x0066509D
0x00664F38
0x00529F68
0x77018744 in BaseThreadInitThunk
0x77C5582D in RtlGetAppContainerNamedObjectPath
0x77C557FD in
On Thursday, 14 June 2018 at 11:07:17 UTC, Shachar Shemesh wrote:
On 14/06/18 13:39, DigitalDesigns wrote:
Wait? Are you sure you are not kidding? Do you want another
shot?
No, I'm fine. Thank you. I am not out here to convert anyone.
If you want to believe the magic of obfuscation, go
On Thursday, 14 June 2018 at 08:54:16 UTC, Shachar Shemesh wrote:
On 14/06/18 08:21, DigitalDesigns wrote:
On Thursday, 14 June 2018 at 02:13:58 UTC, Shachar Shemesh
wrote:
With that said, what you're trying to achieve is probably not
a good idea anyways. With very few exceptions(1),
On Thursday, 14 June 2018 at 02:13:58 UTC, Shachar Shemesh wrote:
On 14/06/18 03:01, DigitalDesigns wrote:
Is there an obfuscator for D that at least renames
identifiers? This is because sometimes they leak from various
processes and could be potential sources of attack.
It would be a tool
Is there an obfuscator for D that at least renames identifiers?
This is because sometimes they leak from various processes and
could be potential sources of attack.
It would be a tool that probably just replaces their values with,
say their hash + something else and done pre release build.
I have to modify preexisting code. As of now, the code fails and
throws an exception at some point. I need to prevent the code
from throwing(easy) but signal to the user of the code some
notification(hard).
It would be cool if I could throw an exception as if the code
yielded and it could be
Also, is there any way to have a field as optional? Right now
when I update a filed in a serialized type the app crashes
because it can't find the field in the serialized data(since it
was just added in the code). This requires either regenerating
the data or manually adding the serialized
On Tuesday, 12 June 2018 at 13:51:56 UTC, Steven Schveighoffer
wrote:
On 6/12/18 1:51 AM, DigitalDesigns wrote:
Could you explain some benefits specific to this
implementation and a bit of the functional aspects for a
proper overview of it's capabilities and why I should chose
this method
On Sunday, 10 June 2018 at 20:10:31 UTC, Steven Schveighoffer
wrote:
iopipe version 0.1.0 has been released.
iopipe is a high-performance pipe processing system that makes
it easy to string together pipelines to process data with as
little buffer copying as possible.
Nothing has really been
I also get a lot of inout's attached to key names. Seems
excessive but
inout(inout(double)[])
/>
Maybe they are necessary but seems like they are redundant.
Changed some things in my app but unrelated to serialization and
now my app fails when trying to read the xml that was generated
at the output of the previous run.
Where it is failing is here:
void checkSpace(ref string s) @safe pure // rule 3
{
import std.algorithm.searching
and if I completely remove the check then everything works fine.
*/
class DocumentParser : ElementParser
{
string xmlText;
/**
* Constructs a DocumentParser.
*
* The input to this function MUST be valid XML.
* This is enforced by the function's in
On Monday, 11 June 2018 at 05:15:05 UTC, Cym13 wrote:
On Sunday, 10 June 2018 at 19:10:52 UTC, DigitalDesigns wrote:
On Sunday, 10 June 2018 at 14:42:21 UTC, Basile B. wrote:
On Sunday, 10 June 2018 at 01:49:37 UTC, DigitalDesigns wrote:
Please allow -J to specify that all subdirectories are
another interesting syntax:
import [] : std.algorithm, std.math;
Does implicit importing on all arrays.
int[] x;
x.canFind(x[0]); // does implicit import for canFind!
At some point we might even be able to get away from 90% of
importing.
Suppose you have a large source file. You use functions from
outside libraries that use other components not directly in their
own library:
module X
import Foo : foo;
auto x = foo();
module Foo;
import F : I;
I foo();
module F;
interface I;
class f : I;
alias Q = I;
f bar(f);
now,
On Sunday, 10 June 2018 at 14:42:21 UTC, Basile B. wrote:
On Sunday, 10 June 2018 at 01:49:37 UTC, DigitalDesigns wrote:
Please allow -J to specify that all subdirectories are to be
included! I'm having to include all subdirectories of my
library with J because I import each file and extract
The idea is that one can use UFCS with templates and types if the
first type matches:
void foo(string T)(int x);
"test".foo(4); <==> foo!("test")(4)
class X;
void foo(T : X)(int x);
X.foo(4) <=> foo!X(4)
This would be unambiguous(since types are not variables in D).
This allows one to
Please allow -J to specify that all subdirectories are to be
included! I'm having to include all subdirectories of my library
with J because I import each file and extract information. It
would be better to have something like
-JC:\Lib\*
rather than
-JC:\Lib\Internal
-JC:\Lib\Internal\OS
allow use of UFCS for delegates
struct X
{
alias D = int function(X);
static D F;
}
Then given x, x.F(); which translates in to X.F(x);
Just because F is local to X shouldn't prevent UFCS from working
on it. If F was global then we should use it and it would work
fine, it's actually
On Wednesday, 6 June 2018 at 14:23:29 UTC, Steven Schveighoffer
wrote:
On 6/5/18 6:28 PM, DigitalDesigns wrote:
Once you do that then I will be able to make an informed
decision rather than doing what you really want, which is
except your world as authority regardless of the real truth.
It's
On Thursday, 7 June 2018 at 23:08:22 UTC, Steven Schveighoffer
wrote:
On 6/7/18 6:58 PM, DigitalDesigns wrote:
On Thursday, 7 June 2018 at 21:57:17 UTC, Steven Schveighoffer
wrote:
On 6/7/18 5:07 PM, DigitalDesigns wrote:
class A;
class B
{
A a = new A();
}
auto b1 = new B();
auto b2 =
On Thursday, 7 June 2018 at 21:57:17 UTC, Steven Schveighoffer
wrote:
On 6/7/18 5:07 PM, DigitalDesigns wrote:
class A;
class B
{
A a = new A();
}
auto b1 = new B();
auto b2 = new B();
assert(b1.a == b2.a)!!
Yep, long-standing issue:
https://issues.dlang.org/show_bug.cgi?id=2947
class A;
class B
{
A a = new A();
}
auto b1 = new B();
auto b2 = new B();
assert(b1.a == b2.a)!!
I'm glad I finally found this out! This is not typical behavior
in most languages is it?
I'd expect it to be translated to something like
class B
{
A a;
this()
{
a = new
On Tuesday, 5 June 2018 at 21:35:03 UTC, Steven Schveighoffer
wrote:
On 6/5/18 5:22 PM, DigitalDesigns wrote:
On Tuesday, 5 June 2018 at 20:07:06 UTC, Ethan wrote:
In conclusion. The semantics you talk about are literally
some of the most basic instructions in computing; and that
escaping
On Tuesday, 5 June 2018 at 19:18:15 UTC, Adam D. Ruppe wrote:
On Tuesday, 5 June 2018 at 19:05:27 UTC, DigitalDesigns wrote:
For loops HAVE a direct cpu semantic! Do you doubt this?
What are they?
And for bonus points, are they actually used by compilers?
Then the final question: is the
On Tuesday, 5 June 2018 at 21:52:03 UTC, Ethan wrote:
On Tuesday, 5 June 2018 at 21:22:27 UTC, DigitalDesigns wrote:
Ok asshat!
Take it to reddit. Back your arguments up with actual knowledge
and intelligence, not unfounded agression.
You are an idiot! You obviously do not understand basic
On Tuesday, 5 June 2018 at 20:07:06 UTC, Ethan wrote:
On Tuesday, 5 June 2018 at 19:05:27 UTC, DigitalDesigns wrote:
For loops HAVE a direct cpu semantic! Do you doubt this?
...
Right. If you're gonna keep running your mouth off. How about
looking at some disassembly then.
for(auto i=0;
On Tuesday, 5 June 2018 at 18:46:41 UTC, Timon Gehr wrote:
On 05.06.2018 18:50, DigitalDesigns wrote:
With a for loop, it is pretty much a wrapper on internal cpu
logic so it will be near as fast as possible.
This is not even close to being true for modern CPUs. There are
a lot of
On Tuesday, 5 June 2018 at 13:05:56 UTC, Steven Schveighoffer
wrote:
On 6/4/18 5:52 PM, DigitalDesigns wrote:
On Monday, 4 June 2018 at 17:40:57 UTC, Dennis wrote:
On Monday, 4 June 2018 at 15:43:20 UTC, Steven Schveighoffer
wrote:
Note, it's not going to necessarily be as efficient, but
it's
On Tuesday, 5 June 2018 at 06:45:31 UTC, Petar Kirov [ZombineDev]
wrote:
On Monday, 4 June 2018 at 15:48:35 UTC, DigitalDesigns wrote:
Does D have any methods of validating code in a natural manner
besides unit tests and contracts?
I'm specifically thinking of validating mathematical
On Monday, 4 June 2018 at 19:26:23 UTC, Joakim wrote:
On Monday, 4 June 2018 at 19:06:52 UTC, Maksim Fomin wrote:
[...]
Unlikely, you don't spend $7.5 billion on a company because you
want to send a message that you're a good dev tools company,
then neglect it.
I suggest you look at their
On Monday, 4 June 2018 at 17:40:57 UTC, Dennis wrote:
On Monday, 4 June 2018 at 15:43:20 UTC, Steven Schveighoffer
wrote:
Note, it's not going to necessarily be as efficient, but it's
likely to be close.
-Steve
I've compared the range versions with a for-loop. For integers
and longs or
Does D have any methods of validating code in a natural manner
besides unit tests and contracts?
I'm specifically thinking of validating mathematical calculations
and boolean operations that could depend on very improbable
scenarios but are technically invalid logic.
These issues tend to
On Sunday, 3 June 2018 at 16:36:52 UTC, Simen Kjærås wrote:
On Sunday, 3 June 2018 at 14:57:37 UTC, DigitalDesigns wrote:
On Sunday, 3 June 2018 at 09:52:01 UTC, Malte wrote:
You might want to have a look at
https://wiki.dlang.org/Dynamic_typing
This sounds very similar to what you are doing.
I'm calling pipe process using
pipeProcess([AliasSeq!args], Redirect.stdout | Redirect.stdin);
where args is a tuple.
Everything works when I pass each argument individually. If I
combine any args using a space it fails or if I pass an argument
with "".
So I guess something like this
On Sunday, 3 June 2018 at 09:52:01 UTC, Malte wrote:
On Saturday, 2 June 2018 at 23:12:46 UTC, DigitalDesigns wrote:
On Thursday, 7 September 2017 at 22:53:31 UTC, Biotronic wrote:
[...]
I use something similar where I use structs behaving like
enums. Each field in the struct is an "enum
On Sunday, 3 June 2018 at 07:30:56 UTC, Meta wrote:
On Saturday, 2 June 2018 at 18:49:51 UTC, DigitalDesigns wrote:
Proposal:
[a..b;m]
m is the stride, if ; is not a good char then |, :, !, or #
could be good chars.
This is exactly what std.range.stride does. The syntax [a..b;m]
directly
On Thursday, 7 September 2017 at 22:53:31 UTC, Biotronic wrote:
On Thursday, 7 September 2017 at 16:55:02 UTC, EntangledQuanta
wrote:
Sorry, I think you missed the point completely... or I didn't
explain things very well.
I don't think I did - your new explanation didn't change my
Proposal:
[a..b;m]
m is the stride, if ; is not a good char then |, :, !, or # could
be good chars.
https://dpaste.dzfl.pl/6c6e614b58ac
The problem given in the list, is that a ref getter is used when
a setter does not exist. Why have a setter then?
One problem is that if the setter has different behavior than the
getter there will be problems.
The other problem is that += modifies the
The above idea can be emulated in code, abiet ugly and useless:
https://dpaste.dzfl.pl/bd118bc1910c
import std.stdio;
struct CT(A,B)
{
A v;
B t;
alias v this;
B opUnary(string s)() if (s == "~")
{
return t;
}
A opUnary(string s)() if
On Wednesday, 30 May 2018 at 18:49:40 UTC, Steven Schveighoffer
wrote:
On 5/30/18 11:50 AM, Stefan wrote:
On Wednesday, 30 May 2018 at 13:26:53 UTC, Steven
Schveighoffer wrote:
On 5/30/18 8:09 AM, DigitalDesigns wrote:
... it's really really hard to make it check real
dependencies.
For
On Wednesday, 30 May 2018 at 15:46:36 UTC, Steven Schveighoffer
wrote:
On 5/30/18 10:49 AM, DigitalDesigns wrote:
Does it sound good?
class X
{
double x;
@property X foo(double y) { x = y; return this; }
@property X bar(double y) { x = y + 5; return this; }
}
void main()
{
X
Does it sound good?
class X
{
double x;
@property X foo(double y) { x = y; return this; }
@property X bar(double y) { x = y + 5; return this; }
}
void main()
{
X x = new X();
x.foo(3).bar(4);
}
It sort of emulates UFCS but I'm not sure if it's more trouble
than it's
On Wednesday, 30 May 2018 at 10:31:27 UTC, Simen Kjærås wrote:
On Monday, 28 May 2018 at 20:13:49 UTC, DigitalDesigns wrote:
I do not think this is a problem in D. Infinite recursion can
always be terminated with appropriate means.
1. Use attributes. methods in class A should be marked as
Seriously stupid bug here!
I had an enum an static this() { } (empty, forgot why I added it)
one module and an struct in another module that converted values
from the enum. I imported only that enum and guess what?!?! Cycle
dependency! removed the static this() { } and worked!
The cycle
On Wednesday, 30 May 2018 at 01:46:30 UTC, Chameleon wrote:
On Monday, 28 May 2018 at 20:13:49 UTC, DigitalDesigns wrote:
Here is my solution that does not solve problem 2:
import std.stdio;
[...]
this is not programming. this is witchcraft!
Just call me Dandalf the D Slayer!
At
On Tuesday, 29 May 2018 at 20:53:14 UTC, DigitalDesigns wrote:
On Tuesday, 29 May 2018 at 20:26:52 UTC, arturg wrote:
On Tuesday, 29 May 2018 at 19:06:24 UTC, DigitalDesigns wrote:
On Monday, 28 May 2018 at 22:15:40 UTC, arturg wrote:
this might help you,
https://dpaste.dzfl.pl/2cf844a11e3f
On Tuesday, 29 May 2018 at 21:41:37 UTC, Ali Çehreli wrote:
On 05/29/2018 02:34 PM, DigitalDesigns wrote:
> auto x(string fp = __FULL_FILE_PATH__)()
{
pragma(msg, fp);
}
?
__FILE_FULL_PATH__
https://dlang.org/spec/expression#specialkeywords
Ali
Lol, thanks:
On Wednesday, 27 July 2016 at 13:58:22 UTC, Jonathan Marler wrote:
On Thursday, 21 July 2016 at 19:54:34 UTC, Jonathan Marler
wrote:
Is there a way to get the full path of the current source
file? Something like:
__FILE_FULL_PATH__
I'm asking because I'm rewriting a batch script in D, meant
https://dpaste.dzfl.pl/67691db19ce8
Just delete 9 to 29 for the code to work. Note that none of the
code effects the output but D gives strange errors. In my code it
says the interface members are not implemented(which they are)
foreach (member; __traits(allMembers, T))
On Tuesday, 29 May 2018 at 20:26:52 UTC, arturg wrote:
On Tuesday, 29 May 2018 at 19:06:24 UTC, DigitalDesigns wrote:
On Monday, 28 May 2018 at 22:15:40 UTC, arturg wrote:
this might help you,
https://dpaste.dzfl.pl/2cf844a11e3f
you can use them to generate the functions as strings.
Thanks,
On Monday, 28 May 2018 at 22:15:40 UTC, arturg wrote:
this might help you,
https://dpaste.dzfl.pl/2cf844a11e3f
you can use them to generate the functions as strings.
Thanks,
So, the problem I'm having is that I cannot use the generated
interface for the abstract class because the abstract
On Monday, 28 May 2018 at 11:51:20 UTC, Simen Kjærås wrote:
On Monday, 28 May 2018 at 09:59:50 UTC, DigitalDesigns wrote:
Implementing interfaces can be a pain but are necessary.
I like to use abstract classes and provide a base
implementation. It would be cool if I could use D's awesome
Implementing interfaces can be a pain but are necessary.
I like to use abstract classes and provide a base implementation.
It would be cool if I could use D's awesome meta features to
extract the interface from the abstract class then build it. This
requires some funky stuff which I'm not
79 matches
Mail list logo