On 03/18/2019 11:54 AM, Roman Sztergbaum wrote:
> Hello as the subject say i'm asking this question because with the
> following code
Andre Pany has already explained. Otherwise, I was going to say
"collectException can collect Exceptions, not exceptions." ;)
There have been many discussions
On 03/15/2019 03:48 PM, H. S. Teoh wrote:
On Fri, Mar 15, 2019 at 10:30:41PM +, eXodiquas via Digitalmars-d-learn
wrote:
On Friday, 15 March 2019 at 21:46:50 UTC, Ali Çehreli wrote:
[...]
Or use template constraints:
struct Vector {
Vector opBinary(string op)(Vector rhs)
if (op
On 03/15/2019 02:43 PM, Sebastiaan Koppe wrote:
On Friday, 15 March 2019 at 21:35:12 UTC, eXodiquas wrote:
Is there any way to achive this behaivour with D2?
Yep. Just make the return type in the function declaration `auto`. You
are then free to return a different type in each static branch.
On 03/09/2019 12:10 PM, ANtlord wrote:
On Saturday, 9 March 2019 at 20:04:53 UTC, Paul Backus wrote:
You can end up with a null `this` reference if you dereference a null
pointer to a struct and then call a method on the result. For example:
I can but my reference is not null before
On 02/28/2019 01:17 PM, Cleverson Casarin Uliana wrote:
> I experimented substituting readf for readln, but then it doesn't
> recognize my Enter presses and hangs on.
>
> What is a more suitable aproach to this problem please?
readln and strip works, and formattedRead can be useful as well. I
On 02/26/2019 01:36 PM, Jordan Wilson wrote:
On Tuesday, 26 February 2019 at 19:58:24 UTC, Andrey wrote:
Hello,
How to break from parallel foreach?
More general question - how to control such loop?
A basic way would be to use a flag:
shared stopWork=false;
foreach (wordBag;
On 02/26/2019 10:50 AM, Mitacha wrote:
> I checked, just out of curiosity, what is staticMap's implementation.
> It's implemented using recursive, this made me think if there is way to
> use static foreach instead.
I'm pretty sure staticMap was implemented way before 'static foreach'.
Perhaps
On 02/19/2019 03:21 PM, SrMordred wrote:
> On Tuesday, 19 February 2019 at 23:03:37 UTC, Paul Backus wrote:
>> Inside a templated struct, the name of the template, by itself,
>> actually refers to the current instantiation. So when you write `Test`
>> in your __traits(isSame) test, the compiler
On 01/30/2019 11:42 AM, H. S. Teoh wrote:
On Wed, Jan 30, 2019 at 10:39:21AM -0800, Ali Çehreli via Digitalmars-d-learn
wrote:
[...]
I wonder why the inconsistency. On the other hand, .mangleof produces
just "add" when the function is extern(C). (?)
[...]
For extern(C), this
On 01/30/2019 07:47 AM, Steven Schveighoffer wrote:
> On 1/30/19 12:14 AM, Sobaya wrote:
>> I want to get a mangled name of a D function by
>> `core.demangle.mangle`, but I'm in trouble because there are no ways
>> to express a type of a function, which is used for a template argument
>> of
On 01/29/2019 09:14 PM, Sobaya wrote:
I want to get a mangled name of a D function by `core.demangle.mangle`,
but I'm in trouble because there are no ways to express a type of a
function, which is used for a template argument of `mangle`.
For example, it is wrong to use the type `int
On 01/24/2019 04:35 AM, FeepingCreature wrote:
> On Tuesday, 27 March 2018 at 12:31:05 UTC, Simen Kjærås wrote:
>> On Tuesday, 27 March 2018 at 12:17:58 UTC, Ellie Harper wrote:
>>> Sorry if this is a stupid question, but is there something special
>>> required to call Appender.clear? When I
On 01/23/2019 07:19 AM, Jacob Shtokolov wrote:
> Expressions like `User.id == 10`, `User.age > 18`, etc. should return a
> struct instead of a bool (let's call it `struct BinaryExpression`).
Have you considered 'alias this'?
struct BinaryExpr(T)
{
T left;
T right;
Op op;
bool value()
On 01/04/2019 01:08 PM, Ali Çehreli wrote:
> There is only one vtbl per class object
Correcting myself after reading Neia Neutuladh's post: I should have
said "There is only one vtbl per class type". Every class object has a
vtbl pointer that points at its type's vtbl.
So, it's normally two
On 01/04/2019 12:46 AM, Alex wrote:
> On Friday, 4 January 2019 at 07:37:43 UTC, bauss wrote:
>> No, because you OVERRIDE A's foo().
>>
>> A does not exist. A is B and when you cast B to A you just tell the
>> compiler that the reference should only have A's signature available.
>>
>> You're not
On 01/03/2019 10:49 AM, Machine Code wrote:
> I wrote a small routine to return the first member
I see that that's possible because the values of such members are known
at compile time in your case. Otherwise, you would need a mechanism that
would return the value of the first member for any
On 12/30/2018 05:05 AM, 0xEAB wrote:
>> interface FooAdapter
>> {
>> FooBundle!(Handle) createSome(Handle)();
>> }
Function templates cannot be virtual functions. One reason is the
compiler cannot know how large the virtual function table should be, and
the other one is it's just a
On 12/27/2018 06:06 PM, Murilo wrote:
> Why is it that when I type "auto choice = randomSample(array);" and
> later when I try to index choice as in choice[1] it gives an error
message?
It's because randomSample returns either an input range or a forward
range depending both on the kind of
On 12/16/2018 11:57 AM, Steven Schveighoffer wrote:
> On 12/16/18 1:37 PM, Marko wrote:
>> On Amazon The D Programming Language has good reviews but it's 8 years
>> old. So is this book still relevant today?
I would still enjoy reading that book but some parts do not match current D.
>
On 12/16/2018 12:00 PM, Steven Schveighoffer wrote:
>> Now there is a compilation error:
>>
>>Orphan format arguments: args[0..1]
>
> Hm... maybe a runtime error? I didn't think the compiler knows to
> complain about this.
Sorry, it was a runtime error. (I was seeing compile time because of
This one confused me until I decided to talk to a rubber ducky:
import std.string;
void main() {
auto s = "%s is a good number".format(42);
}
Fine; it works... Then the string becomes too long and I split it:
auto s = "%s is a good number but one needs to know" ~
" what
On 12/14/2018 05:37 AM, J-S wrote:
I'm sorry for asking such a stupid question, but can anybody point me to
a precooked consistent set of customizations?
Good question. My Emacs D editing is suboptimal as well.
Ali
On 12/06/2018 02:50 PM, albertas-jn wrote:
If templates are a compile-time feature and instances of templates are
generated by compiler at compile time, why is it possible to compile a
template definition with dmd -lib or -c?
There is no trace of the template in the library or the object
On 11/15/2018 09:14 AM, Carl Sturtivant wrote:
> opDispatch is special in that it allows for functions to be added to a
> class or struct when undefined overtly but used elsewhere but it seems
> those functions sadly are final.
>
> Can anything useful be done to remedy the situation?
For the
On 11/12/2018 11:10 PM, Jamie wrote:
> I would like my class to inherit from one of two classes based on a
> boolean value known at compile time. Something like this:
>
> void main()
> {
> Top!(OPTION.FALSE) top = new Top!(OPTION.FALSE);
> }
>
> enum OPTION
> {
> FALSE = 0.,
> TRUE
On 11/03/2018 06:17 PM, Luigi wrote:
I need to call a function that can create a function from an array of
functions and calls them in reverse order. I am learning D any help
would be
import std.stdio;
import std.algorithm;
import std.array : array;
import std.range;
auto comp(T)(T
On 11/01/2018 09:14 AM, Neia Neutuladh wrote:
The spec says that a user-defined attribute must be an expression, but DMD
accepts a wide range of things as UDAs:
struct Foo { string name = "unknown"; }
@Foo int bar;
`bar` has the *type* Foo as an attribute. It's not an *instance* of Foo.
On 10/27/2018 09:16 PM, learnfirst1 wrote:
I plan to use function pointer least significant bit to store some
information.
If there is no GC on my system, I think it will help the memory is well
aligned.
The question is all the function least significant bit is zero ?
Most definitely.
On 10/18/2018 07:04 PM, Samir wrote:
> myArray.length = noValues; // I get a run-time error if I comment
> this out
It's because the expression that reads the elements below is readf,
which reads on top of an existing element.
> while (i < noValues) {
> write("enter value
On 10/17/2018 01:53 PM, Vijay Nayar wrote:
> https://dlang.org/spec/expression.html#new_expressions
>
> If a NewExpression is used as an initializer for a function local
> variable with
> scope storage class, and the ArgumentList to new is empty, then the
> instance is
> allocated
On 10/17/2018 12:32 AM, aliak wrote:
Hi,
Is there any notion of lazy vars in D (i see that there're parameters)?
i.e:
struct S {
//...
int y;
//...
}
lazy S x = () {
// do some heavy stuff
}();
if (condition) {
func(x.y); // heavy stuff evaluated here
}
Cheers,
- Ali
On 10/17/2018 01:24 PM, Vijay Nayar wrote:
I have a snippet of code like this:
scope chordAngle = new S1ChordAngle(_center, other._center);
return _radius + other._radius >= chordAngle;
The reason the "scope" temporary variable exists is to avoid a heap
allocation and instead prefer
On 10/15/2018 01:36 PM, Márcio Martins wrote:
> Considering that the declaration is legal, and that the template
> parameter deduction works when Args.length == 0, but stops working when
> Args.length > 0.
For deduction to work, there must be function arguments. So, just add
Args to the
On 10/06/2018 01:07 PM, bauss wrote:
> uniq will not work with, say a class and the class will require you to
> implement opCmp, which you can't always do for classes you don't have
> access to.
Remembering that uniq works with a custom predicate, which should be
sufficient in most of those
On 10/02/2018 07:39 AM, Vinod K Chandran wrote:
> Thanks a lot. Great help !. I will sure the check the link. :)
I find the Index section useful (yes, can be improved). For example,
just seach for "append" on this page:
http://ddili.org/ders/d.en/ix.html
> The doumentation did not tell me
On 09/21/2018 12:25 AM, Chris Katko wrote:
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh wrote:
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote:
All I want to do is loop from 0 to [constant] with a for or foreach,
and have it split up across however many
On 09/08/2018 02:19 AM, Suliman wrote:
> Is it's correct to say that ALL types that can grow are place on heap
> and types that not growing (int, char, pointer) are place on stack?
The question is not that simple. :)
First, there is also the area used for objects that are static and
object
You can strip off any attribute with SetFunctionAttributes:
import std.stdio;
// Adapted from std.traits.SetFunctionAttributes documentation
import std.traits;
auto assumeNoGC(T)(T t)
if (isFunctionPointer!T || isDelegate!T)
{
enum attrs = functionAttributes!T | FunctionAttribute.nogc;
On 07/30/2018 10:40 AM, realhet wrote:
Hello,
I've already found out how to create an array with uninitialized
elements, but what I'm looking for is a way to append 16 uninitialized
ushorts to it and after I will it directly from 2 SSE registers.
The approximate array length is known at the
On 07/26/2018 09:24 AM, jmh530 wrote:
> On Thursday, 26 July 2018 at 08:08:17 UTC, Timoses wrote:
>> On Wednesday, 25 July 2018 at 21:17:38 UTC, jmh530 wrote:
>> Regarding this example
>>
>> void fun() {
>> /*const*/
>> {
>> double bar;
>> }
>>
>> static assert(!is
On 07/24/2018 02:47 AM, Timoses wrote:
> Why does this fail while it works when replacing T with U in struct
> W(T)?? It's so odd. Both T and U seem to resolve to "string".
>
> struct W(T) {
> const T value;
> // Replacing `T value` with `U value` compiles
>
On 07/22/2018 03:51 PM, aliak wrote:
> Hi,
>
> In the code below:
>
> struct W(T) {
> T val;
> this(T val) inout {
> this.val = val;
> }
> }
>
> class C {}
>
> void main() {
> W!C a = new C;
> immutable W!C b = new C;
> }
>
> W!C a = new C results in: "Error:
On 07/19/2018 08:12 AM, Emma wrote:
> void test(alias fn1, alias fn2)()
> {
> fn1();
> fn2();
> }
>
> struct Foo
> {
> void foo()
> {
> test!(bar, baz);
> }
>
> void bar()
> {}
>
> void baz()
> {}
> }
> ---
>
> If I try to compile it, dmd
On 07/16/2018 03:08 PM, Eric wrote:
This makes the compiler crash.
Always a compiler bug:
https://issues.dlang.org/show_bug.cgi?id=19089
Ali
First, please show us code that demonstrates the issue.
On 07/14/2018 07:47 AM, vino.B wrote:
>The reason it never prints the text "Empty" is that the out of the
> "r" is just an empty array.
>
> OUTPUT:
> []
> []
If that's the output of r, then r is not empty but has two elements and
On 07/06/2018 07:36 AM, Michael wrote:
> but not in
> my case, if this is a weird edge-case with setter member functions?
This is all very interesting but I'm dying to see the code. :) Can you
change Timoses's code to demonstrate your case?
Ali
On 07/05/2018 01:00 PM, ag0aep6g wrote:
> `immutable` means that the data can't ever change. Not even the owning
> Foo is allowed to change it. If you want to disallow changes from
> outside, but still allow the owning Foo to make changes, use `const`:
>
> static const(Foo[]) getFooList()
On 06/30/2018 05:17 AM, Steven Schveighoffer wrote:
Isn't this what only does? https://dlang.org/phobos/std_range.html#only
Cool. :)
import std.range : only;
auto t = tuple(5, 3.5, false);
auto r = only(t.expand);
Ali
On 06/29/2018 02:11 PM, Timoses wrote:
> How would one print the address of the object then though?
> Since is the address of the reference' types stack location.
Casting the reference to void* produces the address of the object:
import std.stdio;
class C {
int i;
}
void main() {
On 06/29/2018 02:40 PM, Robert M. Münch wrote:
> How does it work if one of the members takes an argument that is deduced
> inside the handler function?
>
>
> On 2018-06-29 18:05:00 +, Ali ‡ehreli said:
>
>> Passing a lambda or a string mixin:
>>
>> import std.stdio;
>>
>> class C {
>>
On 06/29/2018 09:44 AM, Robert M. Münch wrote:
So, how can I write a generic handler that does the iteration, where I
can specify which member function to call?
Passing a lambda or a string mixin:
import std.stdio;
class C {
void A() {
writeln(__FUNCTION__);
}
void B()
On 06/28/2018 11:10 PM, Jonathan M Davis wrote:
> On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote:
>> Wouldn't this be weird from the semantic view?
I agree with all your concerns. The fact that Meta decided to make the
element type Algebraic!T as opposed to my
On 06/28/2018 11:08 AM, Mr.Bingo wrote:
> Thanks, why not add the ability to pass through ranges and arrays and
> add it to phobos?
Makes sense. It needs an enhancement request at
http://issues.dlang.org/, a good implementation, and a pull request. :)
Ali
On 06/28/2018 10:00 AM, Mr.Bingo wrote:
> But is this going to be optimized?
Not our job! :o)
> That is, a tuple is a range!
Similar to the array-slice distinction, tuple is a container, needing
its range.
> It is clearly easy to see if a tuple is empty, to get the front,
Ok.
> and to
>
On 06/26/2018 10:37 AM, Rib wrote:
to get get() from std.net.curl return a ubyte[] and use my http
instance, all those failed:
string link = "http://...;;
auto client = HTTP();
// set some client attributes...
auto fileContents = get!(AutoProtocol, ubyte)(link, client);
auto fileContents =
On 06/22/2018 08:17 AM, Steven Schveighoffer wrote:
> reason to use functors
I wonder whether they are more efficient because a functor would carry
just the state that it needs. Also, there is no GC memory allocation
unless the programmer wants to.
I wonder how much state is allocated for a
On 06/20/2018 08:06 AM, rikki cattermole wrote:
This board is for the D programming language.
The one you want is https://forum.dlang.org/group/c++
And the Lesson 1 he wants is http://ddili.org/ders/d.en/hello_world.html :o)
Ali
On 06/12/2018 01:14 PM, bauss wrote:
> What could cause that error?
Could be this point apparently during semantic analysis:
https://github.com/dlang/dmd/blob/4e35f945e3245467c7ae0abe60fc3ec896c8b45f/src/dmd/semantic2.d#L576
private extern(C++) final class Semantic2Visitor : Visitor
{
//
On 06/09/2018 02:09 PM, OlegZ wrote:
On Saturday, 9 June 2018 at 20:55:21 UTC, drug wrote:
In fact using `=>` you really define a function returning delegate.
I see. Thanks.
There is some explanation at the following page, of how the lambda
syntax is related to the full syntax:
On 06/08/2018 11:13 AM, Brian wrote:
> Like:
>
> class A
> {
> string b;
> string c;
> }
>
> compile-time to:
>
> class A
> {
> string _b;
> string c;
> }
>
> or:
>
> class A
> {
> string c;
> }
>
If these are your classes you can use static if or version:
version = Z;
On 06/02/2018 02:44 PM, greatsam4sure wrote:
> is it possible to define infix function in D
>
> 3.min(5)// 3: where min is a function, works in D
> 3 min 5 // does not work.
This is called universal function call syntax (UFCS) in D. The idea is
simple: You can pull the first argument out as if
On 06/01/2018 09:40 AM, Russel Winder wrote:
> The assert is in Phobos, so I am not sure I can.
Not the cleanest solution but one can always "carefully" :) edit the
installed Phobos files. Mine are under /usr/include/dmd/phobos/std/ It
will most likely work as they are almost always
On 06/01/2018 04:12 AM, Russel Winder wrote:
Obviously std.concurrency.receive should never terminate a thread, and
it should never terminate a thread silently, but given that it clearly
does (using dmd 2.080 from d-apt on Debian Sid) how is one to find out
useful information as to why it is
On 05/31/2018 09:49 AM, Adam D. Ruppe wrote:
> Should be fairly simple to follow, just realize that the image is a 2d
> block for each char and that's why there's all those multiplies and
> divides.
I remember doing similar things with fonts to add Turkish characters to
Digital Research and
On 05/30/2018 03:16 PM, aberba wrote:
On Sunday, 27 May 2018 at 16:00:15 UTC, Jonathan M Davis wrote:
On Sunday, May 27, 2018 16:28:56 Russel Winder via Digitalmars-d-learn
wrote:
On Sun, 2018-05-27 at 13:10 +, Adam D. Ruppe via Digitalmars-d-learn
- Jonathan M Davis
Jonathan, which
On 05/30/2018 02:19 PM, Malte wrote:
Why does this code complain at the last line about a missing [] operator
overload?
auto buffer = new char[6];
auto chunked = buffer.chunks(3);
chunked[1][2] = '!';
Same happens with wchar.
Dchar and byte work as expected.
UTF-8 auto decoding strikes
On 05/30/2018 01:09 PM, Dr.No wrote:
> consider a C function with this prototype:
>> void foo(const char *baa);
>
> Does it means I should do:
>
>> string s = ...;
>> auto cstring = s.toStringz;
>> foo(cstring);
>
> rather just:
>
>> foo(s.toStringz);
>
> ?
It depends. cstring method above is
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
On 05/28/2018 11:47 AM, candle wrote:
Hey Folks.
I have a question about threading and how to close threads i don't need
anymore.
In the following code, i build 3 threads with spawn from the concurrency
module.
if one thread found the number, all others thread must stop search.
but i
On 05/23/2018 06:49 AM, Steven Schveighoffer wrote:
Apparently, but that's not very good. IMO, it should use the same rules
as foreach. In which case, BOTH lines should fail to compile.
-Steve
I think this is a compiler bug (limitation), which I think has been
reported already (or similar
On 05/23/2018 12:47 AM, Robert M. Münch wrote:
On 2018-05-22 18:34:34 +, Ali ‡ehreli said:
An idiom known in C++ circles is a Lippincott function:
https://cppsecrets.blogspot.ca/2013/12/using-lippincott-function-for.html
Just wanted to mention that it can be a part of a clean
On 05/22/2018 11:20 AM, Robert M. Münch wrote:
I see that I'm writing
try {
... different code ...
} catch (myException e) {
... same handling code ...
}
over and over again.
Of course I can put the exception handling code into a function to not
duplicate it. However, I still need to
On 05/20/2018 10:46 AM, Robert M. Münch wrote:
> But I still don't understand why I can't write things explicitly but
> have to use an alias for this.
Templatized range types work well when they are used as template
arguments themselves.
When you need to keep a single type like 'b' (i.e. b
On 05/14/2018 03:03 PM, Jonathan wrote:
Do I need to call the `free` function with my D code because I need to
free memory that was allocated in C code?
Yes, you have to free the memory with C's free():
void main() {
import core.stdc.stdlib;
auto p = malloc(42);
free(p);
}
Ali
On 05/13/2018 12:42 AM, Suliman wrote:
Could anybody give small example of Dependency injection pattern? I
googled about it, but found only C# examples and I am not quite sure how
to use them.
Also I would like get some explanation/comments for code.
The name and the unnecessary confusion
On 05/10/2018 01:03 PM, Dlang User wrote:
>> this didn´t work either.
>> note that 'f.data+= 2;' don't call the write property
>
> That's odd, it works on my machine (Windows 10 with V2.079.0 DMD
compiler).
Try putting writeln expressions in the two functions to see which one
gets called. ;)
On 04/26/2018 10:56 AM, Dr.No wrote:
> class C
> {
>
> void error(A...)(string fmt, A args)
> {
> import report : error;
> reportedAnyError = true;
> error(fmt, args);
> }
> alias warning = report.warning;
> }
>
>
> I got this:
>
> Error: undefined
On 04/15/2018 11:46 PM, WhatMeForget wrote:
>
> I think I got a handle on D's static and dynamic arrays, till I come to
> std.array and see all the shiny new tools. I can understand all the
> replace.. functions, but the appender function gave me pause. The
> documentation says appender "Returns
On 04/12/2018 02:22 PM, Chris Katko wrote:
On Thursday, 12 April 2018 at 21:17:30 UTC, Paul Backus wrote:
On Thursday, 12 April 2018 at 20:34:40 UTC, Chris Katko wrote:
But each doesn't return anything, it mutates, right? I think that's
the problem I ran into with my attempt. With your code,
On 04/06/2018 11:26 PM, Uknown wrote:
> On Saturday, 7 April 2018 at 05:58:10 UTC, Paul Backus wrote:
>> On Saturday, 7 April 2018 at 05:46:07 UTC, Uknown wrote:
>>> I don't see the error you are talking about:
>>> https://run.dlang.io/is/XWPIc1
>>>
>>> Are you using the latest compiler?
>>
>>
On 03/29/2018 02:23 PM, Cym13 wrote:
On Thursday, 29 March 2018 at 20:29:39 UTC, aerto wrote:
how i can convert Hello world! to hex 48656c6c6f20776f726c6421 ??
Maybe something like:
void main() {
// Those look like lots of imports but most of those are very
common anyway
import
On 03/27/2018 11:11 PM, Chris Katko wrote:
> writeln(a[0]); //first is "pos(100,100)"
> static if(
> is(a[0] == pos) //<---never matches
It's because not a[0] but its *type* is pos:
is(typeof(a[0]) == pos) //<---MATCHES! :)
Ali
On 03/27/2018 05:15 PM, Per Nordlöw wrote:
Is there a way to check if a struct `S` can be initialized using zero
bits only, so that we can allocate and initialize an array of `S` in one
go using `calloc`? If not, what should such a trait look like?
The following idea should work. One question
On 03/23/2018 03:43 PM, Xavier Bigand wrote:
> I am trying to initialize an global immutable associative array of
> structs, but it doesn't compile.
Current solution is to initialize the AA in a 'static this()' block or
('shared static this()').
> I am getting the following error message :
On 03/23/2018 12:25 PM, Cecil Ward wrote:
> On Friday, 23 March 2018 at 01:23:56 UTC, Cecil Ward wrote:
>> I am wanting to write a short program (on a ‘server’ you could say)
>> that takes a command, runs it (as on the command line, so an
>> executable with arguments or a shell command) and
On 03/22/2018 02:45 AM, Danny Arends wrote:
Hey all,
When running a D program that i wrote (32bit mode, windows10), an
OutOfMemory exception being thrown when executing the program:
core.exception.OutOfMemoryError@src\core\exception.d(702): Memory
allocation failed
However there is no
On 03/22/2018 06:16 AM, berni wrote:
Part of my code looks like this:
out (result)
{
if (result==true)
{
lots of assertions...
}
}
I would prefer an early exit like:
out (result)
{
if (result==false) return;
lots of assertions...
}
Is this possible somehow (return and
On 03/21/2018 11:44 AM, realhet wrote:
float x,y,z;
if(formattedRead(" vertex -5.1 2.4 3.666".strip, "vertex %f %f
%f", x, y, z)){
writefln("v(%f, %f, %f)", x, y, z);
}
formattedRead wants to modify the source, so it takes it by reference,
which rvalues cannot be passed
On 03/21/2018 11:00 AM, Russel Winder wrote:
> The code I am playing with generated by DStep involves lots of lots of
> structs with mixin bitfields. All of them seem to compile file, except
> one. How is it that:
>
> mixin(bitfields!(
> ubyte, "current_next", 1,
> ubyte,
On 03/21/2018 04:30 AM, Timoses wrote:
Hey,
I'm struggling to find a way to achieve this. I've looked through
std.algorithm but didn't find anything.. Maybe I'm blind.
What I would like to do is filter out all spaces in a string and change
the front letter to lower case:
string m =
On 03/17/2018 11:36 AM, Jonathan wrote:
`(a+b)&0xff` What is this syntax?! Could you give a link to this in the
D documentation?
Here is my description of bitwise AND:
http://ddili.org/ders/d.en/bit_operations.html#ix_bit_operations.&,%20bitwise%20and
The section titled "Masking" on the
On 03/15/2018 03:16 AM, Andrey wrote:
Hello, is there way to declare read only field for class type with
ability to call inner non constant methods? i.e.:
class A {
int value = 12;
void updateValue() {
value = 13;
}
}
class B {
const A a;
this() {
a = new
On 03/07/2018 10:57 AM, Matt Gamble wrote:
This is a record for me with two 32bit vs 64bit issues in one day. Seems
to be a problem with using "each" under 32bit which can be fixed by
using foreach or switching to x64. Am I doing something wrong or is this
the second bug I've found today?
On 02/28/2018 11:22 AM, Nordlöw wrote:
On Tuesday, 27 February 2018 at 20:14:01 UTC, Ali Çehreli wrote:
And to be sure, one can have an actual object that represents nullness
and use its pointer. (Similar to "the null object pattern".)
Ali
Are there any pros to this pattern compared to just
On 02/27/2018 11:56 AM, Steven Schveighoffer wrote:
On 2/27/18 11:37 AM, Nordlöw wrote:
On Tuesday, 27 February 2018 at 16:31:51 UTC, Steven Schveighoffer wrote:
Why not use null?
It's already used to indicate that a slot is free. :)
cast(void*)1 is likely to be unused.
-Steve
And to
On 02/19/2018 05:33 AM, rikki cattermole wrote:
https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min
Accompanying presentations:
DConf 2017: https://www.youtube.com/watch?v=29h6jGtZD-U
Google Tel Aviv: https://www.youtube.com/watch?v=es6U7WAlKpQ
Andrei likes the
On 02/15/2018 01:57 PM, Steven Schveighoffer wrote:
> Really, i should be size_t in all places
size_t or ulong? size_t would constrain 32-bit systems unless they can't
handle files over 2G.
Ali
On 02/16/2018 09:58 AM, Nordlöw wrote:
void g() pure
{
static assert(!__traits(compiles, { auto x = f(42); }));
alias pureF = assumePure!(typeof());
// TODO: how do I call pureF?
// auto x = (*pureF)(42);
// auto x = pureF(42);
}
auto pureF = assumePure();
On 02/15/2018 09:53 AM, Kyle wrote:
> I want to be able to pass an int to a function, then in the function
> ensure that the int is little-endian (whether it starts out that way or
> needs to be converted) before additional stuff is done to the passed
> int.
As has been said elsewhere, the
On 02/09/2018 05:14 PM, Alex wrote:
>> > struct E
>> > {
>> > size_t i;
>> > static T[] tarr;
>>
>> To save time to others, note that 'tarr' is a static member that ends
>> up being shared by two Typedef instantiations.
>
> Yup. They are shared by two Typedef instantiations with
1001 - 1100 of 2532 matches
Mail list logo