On 2017-10-12 21:42, Daniel Kozak wrote:
Wow, C# is really wierd. They have method IsNullOrEmpty (OK why not),
but they have IsNullOrWhiteSpace OK little akward but still OK until you
realized it is more like IsNullOrEmptyOrWhiteSpace :D
It's pretty neat functionality. Ruby has it (or rather R
On Wednesday, 11 October 2017 at 22:22:43 UTC, Johan Engelen
wrote:
std.string.removechars is now deprecated.
https://dlang.org/changelog/2.075.0.html#pattern-deprecate
What is now the most efficient way to remove characters from a
string, if only one type of character needs to be removed?
``
On Thursday, October 12, 2017 23:33:39 Psychological Cleanup via
Digitalmars-d-learn wrote:
> Is there any way to get the function body of a function,
> delegate, and lambda? I'd also like to extend functions by
> "wrapping" them at compile time generically. For example, I'd
> like to get all the
On Thursday, October 12, 2017 21:22:29 kdevel via Digitalmars-d-learn wrote:
> On Thursday, 12 October 2017 at 20:27:03 UTC, Jonathan M Davis
>
> wrote:
> > On Thursday, October 12, 2017 20:15:41 kdevel via
> >
> >> ---
> >> void main ()
> >> {
> >>
> >> assert (false);
> >>
> >> }
> >> ---
> >
On Friday, 13 October 2017 at 01:12:38 UTC, solidstate1991 wrote:
On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991
wrote:
I'm making a struct for easy color handling Here's a code
sample:
ublic struct Color{
union{
uint raw; ///Raw representation in integer form, also force
On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote:
I'm making a struct for easy color handling Here's a code
sample:
ublic struct Color{
union{
uint raw; ///Raw representation in integer form, also forces
the system to align in INT32.
ubyte[4] colors; ///Normal repre
I'm making a struct for easy color handling Here's a code sample:
ublic struct Color{
union{
uint raw; ///Raw representation in integer form, also forces
the system to align in INT32.
ubyte[4] colors; ///Normal representation, aliases are used for
color naming.
ubyt
I'd also like to be able to save and store delegates, functions,
and lambdas. One can't store the pointer to the function because
it will be invalid, so another means is required, any ideas?
Save("f", (int){ ... }); // Saves to disk
auto f = Load("f"); // Loads from disk
f(3);
Is there any way to get the function body of a function,
delegate, and lambda? I'd also like to extend functions by
"wrapping" them at compile time generically. For example, I'd
like to get all the properties of a class and add some code to
them(sort of like adding a scope, prolog, and/or epilo
On Thursday, 12 October 2017 at 02:18:49 UTC, Mr. Jonse wrote:
A simple(incomplete) undo system.
I'd think that for D you'd want to do type wrapping where a new
type is created which saves changes and can manage an Undo tree.
__gshared Data data = new Data();
auto undoable = Undo!dat
On Tuesday, 10 October 2017 at 02:36:56 UTC, Mr. Jonse wrote:
I requiring an undo feature in my code. Rather than go the
regular route of using commands, I'm wondering if D can
facilitate an undo system quite easily?
We can think of an undo system in an app as a sort of recorder.
The traditio
On Thursday, 12 October 2017 at 20:27:03 UTC, Jonathan M Davis
wrote:
On Thursday, October 12, 2017 20:15:41 kdevel via
---
void main ()
{
assert (false);
}
---
qualifies as "invalid, and therefore has undefined behaviour."
A statement, which makes no sense to me. Either it is a
"debuggin
On Wednesday, 11 October 2017 at 07:09:26 UTC, Daniel Kozak wrote:
You can avoid cast:
void foo(T)(T bar){...}
byte bar = 9;
foo!byte(bar + byte(1));
Sure?
---
void foo(T)(T bar)
{
}
byte bar = 9;
void main ()
{
foo!byte(bar + byte(1));
}
---
byte2.d(7): Error: function byte2.foo!byte.foo
On Thursday, October 12, 2017 20:15:41 kdevel via Digitalmars-d-learn wrote:
> On Thursday, 12 October 2017 at 15:37:23 UTC, John Burton wrote:
> > C++ compilers can and do perform such optimizations so I was
> > wondering if assert in D could cause such behavior according to
> > the spec.
>
> In t
On Thursday, 12 October 2017 at 15:37:23 UTC, John Burton wrote:
C++ compilers can and do perform such optimizations so I was
wondering if assert in D could cause such behavior according to
the spec.
In the context of ISO-C++ it is meaningless to reason about the
"actual behavior" of a non-co
Wow, C# is really wierd. They have method IsNullOrEmpty (OK why not), but
they have IsNullOrWhiteSpace OK little akward but still OK until you
realized it is more like IsNullOrEmptyOrWhiteSpace :D
On Thu, Oct 12, 2017 at 8:11 PM, Nieto via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> w
On Thursday, 12 October 2017 at 18:17:54 UTC, Adam D. Ruppe wrote:
On Thursday, 12 October 2017 at 18:11:55 UTC, Nieto wrote:
Does D have an equivalent to C#'s String.IsNullOrWhiteSpace()
in the standard library?
import std.string;
if(str.strip().length == 0) {
// is null, empty, or all whi
On Thursday, 12 October 2017 at 18:11:55 UTC, Nieto wrote:
Does D have an equivalent to C#'s String.IsNullOrWhiteSpace()
in the standard library?
import std.string;
if(str.strip().length == 0) {
// is null, empty, or all whitespace
}
Does D have an equivalent to C#'s String.IsNullOrWhiteSpace() in
the standard library?
just asking if there's a native one, so I don't need reinvente
the wheel
https://msdn.microsoft.com/en-us/library/system.string.isnullorwhitespace%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
On Thursday, 12 October 2017 at 14:22:43 UTC, Timon Gehr wrote:
On 11.10.2017 11:27, John Burton wrote:
Yes, that's what it is saying. (The other answers, that say or
try to imply that this is not true or true but not a bad thing,
are wrong.)
...
However, in practice, I think none of the
On 11.10.2017 11:27, John Burton wrote:
The spec says this :-
"As a contract, an assert represents a guarantee that the code must
uphold. Any failure of this expression represents a logic error in the
code that must be fixed in the source code. A program for which the
assert contract is false
21 matches
Mail list logo