On 4/20/21 3:03 PM, Simen Kjærås wrote:
On Tuesday, 20 April 2021 at 18:57:46 UTC, ichneumwn wrote:
So my questions:
- is there a module-crossing equivalent of "version"?
mw covered this. There's more documentation here:
https://dlang.org/spec/version.html#version
https://dlang.org/dmd-windo
On 4/15/21 11:21 PM, Jack wrote:
> didn't find much help on the docs.
In case it's useful to others as well, I have two chapters on ranges:
http://ddili.org/ders/d.en/ranges.html
http://ddili.org/ders/d.en/ranges_more.html
Ali
On 4/15/21 1:56 PM, mw wrote:
>>> I wanted to find out if it is possible to create classes dynamically.
>>
>> out of curiosity: Why you would like to do this? I cannot think of a
>> use case for this - this is why i ask.
>
> In response to user input?
That's a different question because creating
On 4/14/21 1:38 PM, Mario wrote:
> Maybe I am just too short in D, but I wanted to find out if it is
> possible to create classes dynamically.
In D world, "dynamically" means "at run time".
> Maybe at mixin templates?
Both mixins and templates are compile time features.
> Normally I would thi
On 4/9/21 11:17 AM, Berni44 wrote:
> I'm on reworking completely the docs of `std.format`.
Awesome! :)
Ali
On 4/9/21 9:11 AM, Oleg B wrote:
> Is space a special char for `formattedRead` and it simple stop parse
> without throwing exception if not found space
Yes: The space character means "zero or more white space".
Ali
P.S. I can't check whether the D standard library documentation includes
that
On 4/7/21 8:57 PM, Brad wrote:
auto a = [1,0,1,1,1,0,1,0,1,1,1,1,0];
I want to come out of this with a string that looks like this:
101110100
Me, me, me, me! :)
import std;
void main()
{
auto a = [1,0,1,1,1,0,1,0,1,1,1,1,0];
string s = format!"%-(%s%)"(a);
writeln(s);
}
Al
On 4/7/21 10:04 AM, novice2 wrote:
On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote:
So, you should change your code to
writefln("%-(%s, %)", s);
sorry i dont read docs so carefully
thanks
For the sake of completeness, I mention this feature in a couple of
other places:
On 4/6/21 12:55 PM, Alain De Vos wrote:
I have one very large text table I want to work with.
But I don't want to keep de table in memory, what do I use ?
Using an sql database is overkill in my setting.
There are 10 colums but millions of rows.
Jon Degenhardt of eBay uses D in similar ways wit
On 4/1/21 9:01 PM, H. S. Teoh wrote:
> 6) (Not described in the thread, but applied later) Reduce GC load even
> further by reusing an array that was being allocated per iteration in
> an inner loop before.
For those who prefer a video description with some accent :) here is how
to appl
On 4/1/21 12:55 PM, H. S. Teoh wrote:
> - Constructing large arrays by appending 1 element at a time with `~`.
>Obviously, this requires many array reallocations and the associated
>copying
And that may not be a contributing factor. :) The following program sees
just 15 allocations and
On 4/1/21 10:15 AM, ag0aep6g wrote:
> Move `auto rnd = ...;` out of the loop, and you will get better times.
Doing that reduces the time about 15 fold.
Using Appender reduces it further a tiny bit:
import std.array;
// ...
Appender!(int[]) mylist;
// ...
mylist.data.sort();
Ali
On 4/1/21 2:30 AM, DLearner wrote:
> immutable uint MemSize=100; // Memory size in bytes.
> ubyte[MemSize] MemPool = 8; // Initialised to 8 for debugging.
Valid index values there are from 0 to 99, inclusive.
> WkPtr = &MemPool[0];
>
> counter = 1;
> while (counter <= 1
On 3/30/21 6:28 AM, novice3 wrote:
> I want create derived type in D
"Derived type" is used in the context of object oriented programming at
least in D but your examples indicate you need something else. How about
the 'alias this' feature?
import std.stdio;
struct Xobj {
void* value;
al
On 3/29/21 8:13 AM, Gavin Ray wrote:
> Brief question, is it possible to write this so that the "alias fn" here
> appears as the final argument?
>
>auto my_func(alias fn)(string name, string description, auto
otherthing)
Yes, as a type template parameter but you would have to constrain the
On 3/23/21 4:14 PM, Imperatorn wrote:> On Tuesday, 23 March 2021 at
22:22:12 UTC, Q. Schroll wrote:
>> For a class object obj, one can use assert(obj) to get its invariants
>> checked. How to do this for structs?
>
> It's called after the constructor has run and before the destructor is
> called.
On 3/17/21 10:21 AM, jmh530 wrote:
> That's a little advanced, I think. And you also have
> http://ddili.org/ders/d.en/slices.html
> saying that slices are just another name for dynamic arrays.
I don't fully agree with myself there. :) Slices are interfaces to many
different kinds of consecutiv
On 3/17/21 3:54 AM, jmh530 wrote:
On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote:
double[] data;
data = cast(double[]) malloc(n * double.sizeof)[0 .. n];
This is one of those things that is not explained well enough.
I have something here:
http://ddili.org/ders/d.en
On 3/11/21 10:06 AM, Chris Piker wrote:
>https://dlang.org/spec/hash-map.html#static_initialization
>
> that this feature is not yet implemented.
I use a shared static this() block:
immutable string[int] aa;
shared static this() {
aa = [ 1: "one" ];
}
void main() {
assert(aa.length ==
On 3/11/21 8:41 AM, Iliya wrote:
> I am using dmd 2.094.1 on linux
Your program links fine for me with 2.094.2 on Linux.
Ali
On 3/6/21 12:15 AM, Imperatorn wrote:
On Saturday, 6 March 2021 at 01:30:35 UTC, MoonlightSentinel wrote:
On Friday, 5 March 2021 at 22:01:37 UTC, Imperatorn wrote:
Any idea why?
The examples are compiled using an older host compiler (__VERSION__ is
2.093) but use features introduced in a la
On 3/5/21 8:29 PM, Jack wrote:
> Now about the behavior of a static destructor, like static ~this() { }
> is this guaranteed to be run?
I don't know any way of creating a module on the GC heap so their
destruction should not be related to GC collection. I would expect all
'static ~this()' bloc
On 3/5/21 12:57 PM, Jack wrote:
>> destroy() executes the destructor.
>
> but I would need to call it manually and only after I somewhat I've
> determined I no longer need the resources, right? so destroy(c) would be
> no different from calling my own finalize-like method like
freeResources()?
On 3/5/21 12:24 PM, Jack wrote:
Are there some kind of replacement or I have to make my own
finalize-like method, once I determine somewhat the application no
longer need those resources?
destroy() executes the destructor.
To my surprise, even though 'c' is not null below, the destructor is
On 2/24/21 10:58 PM, FeepingCreature wrote:
On Thursday, 25 February 2021 at 06:57:57 UTC, FeepingCreature wrote:
On Thursday, 25 February 2021 at 06:47:11 UTC, Mike wrote:
hi all,
If i have an array:
byte[3] = [1,2,3];
How to get string "123" from it?
Thanks in advance.
string str = forma
On 2/23/21 7:52 PM, Kyle Ingraham wrote:
Where would one find information on this
There are Point and Polygon struct templates on the following page where
one can pick e.g. the dimension (e.g. three dimensional space) by a
size_t template parameter.
http://ddili.org/ders/d.en/templates_mo
On 2/22/21 2:00 PM, Jack wrote:
> C defValue() { return C.a; }
Yes, putting the expression in a function is the way I know for lazy
evaluation.
Ali
On 2/21/21 7:28 PM, Preetpal wrote:
> I decided to implement what I meant (single application (executable)
> instance restriction) using the Windows API (since my application only
> runs on Windows currently anyways):
I achieve it with 'flock' (man 2 flock) on Linux. My case is different
thoug:
On 2/15/21 1:04 PM, Jack wrote:
> I have to make my function nothrow because the function that calls it
> (not written by me) is nothrow. So I need to wrap my code in a
> try-catch() but how will I report the error message, if the toString()
> from Throwable isn't nothrow? how do I get out this c
On 2/11/21 6:22 PM, H. S. Teoh wrote:
>bool[size_t] hashes;
I would start with an even simpler solution until it's proven that there
still is a memory issue:
import std.stdio;
void main() {
bool[string] lines;
foreach (line; stdin.byLine) {
if (line !in li
On 2/6/21 2:26 PM, mw wrote:
On Tuesday, 31 December 2019 at 14:52:55 UTC, Steven Schveighoffer wrote:
On 12/31/19 9:47 AM, Steven Schveighoffer wrote:
for the original example:
int[] a = [77,66,55,44];
int i = a.bwin.find(55).bufRef.pos;
sorry, should be size_t i.
Unsigned?
On 2/5/21 1:10 PM, Rumbu wrote:
I gave up after reading a lot, but I didn't manage to understand the
meaning "&& ..."
I think it's the universal reference.
template static uint8_t composite_index_size(Tables
const&... tables) { return (composite_index_size(tables.size(),
impl::bits_needed(
On 2/3/21 8:44 AM, Marcone wrote:
relevant opinion
I think the following would be improvements:
>char[8192] request;
I don't know the protocol but obviously 8192 must be sufficient.
>auto rq = c.receive(request);
So, what is actually received is request[0..rq]. I would call the firs
While we're on topic, the size of a class type and a class variable both
are constant on a platform, e.g. 8 bytes on 64 bit systems. To get the
size of actual instances (objects) of this type, one needs to use the
classInstanceSize trait:
class C {
int i;
}
void main() {
auto a = new C();
On 1/30/21 1:34 AM, Imperatorn wrote:
> With this knowledge we have now, what changes could and/or should be
> made to make this process easier? 🤔
I wonder whether doing something in the runtime is possible. For
example, it may be more resilient and not crash when suspending a thread
fails bec
On 1/24/21 2:28 AM, IGotD- wrote:
> Any threads started by druntime has proper initialization of course. Any
> thread started by any module written in another language will not do D
> the thread initialization.
And that of course has been what I've been trying to deal with. Bugs in
the uses of
On 1/29/21 2:41 PM, WhatMeWorry wrote:
Ali's book talks about the
colon appearing for
There is also "is, expression":
http://ddili.org/ders/d.en/is_expr.html#ix_is_expr.is,%20expression
But the is expression is so complicated. :( I defined that particular
syntax as
is (T : Specifier
On 1/28/21 3:45 PM, Anthony wrote:
> void end(AccumulatorPipe acc) {
> auto pids = acc.pids ~ P.spawnShell("cat", acc.stdout);
>
> foreach (pid; pids) {
> P.wait(pid);
> }
> }
> ```
>
>
> So now I can do something like:
> ```
> run("find source -name '*.d'")
> .pi
On 1/28/21 2:16 AM, Anthony wrote:
> auto p = pipeProcess("ls");
> auto q = pipeProcess("cat", stdin = p.stdout); //it would be good to do
That would work if `cat` received the *contents* of the files (and with
a "-" command line switch). Since `ls` produces file names, you would
have to make
On 1/26/21 6:31 AM, frame wrote:
> all GCs
Multiple D runtimes? That might work I guess but I've never heard of
anybody talking about having multiple runtimes. Does rt_init()
initialize *a* D runtime or *the* D runtime? If it indeed works we
definitely need much better documentation.
I load
On 1/25/21 8:14 AM, vitamin wrote:
> If created on the default way mean allocated with new (=> GC)
I had the same thought. The following would be the "default way" for me
but passing that object's address to addRoot would be wrong:
import core.memory;
struct S {
}
void main() {
auto a = S
Thank you very much for your answers. I think I've been on the right
track and the following bug that I've mentioned has been messing up by
hitting me randomly:
https://issues.dlang.org/show_bug.cgi?id=11736
On 1/23/21 5:18 PM, IGotD- wrote:
> During rt_init in the main thread, thread_attac
tl;dr I know enough to sense there are important stuff that I don't know.
Even though I sometimes act[1] like someone who knows stuff, there are
many fuzzy areas for me especially in the runtime.
Things work great when D code is inside a D program. The runtime and
module states are magically
On 1/21/21 4:51 PM, H. S. Teoh wrote:
> But I wouldn't be surprised if there was some
> surprising corner case for which this doesn't work / would have onerous
> characteristics.
Likely. :) Here is one for uniq.back, which includes a link at the
bottom for zip.back:
https://issues.dlang.org
I may know the answer but I can't be sure because you don't provide code
that reproduces the issue.
I am trying to write code below according to your description but it's
really tough. Can you reproduce the issue please.
// T = some class
// T is not a good name because it is usually
On 1/19/21 10:28 AM, Per Nordlöw wrote:
> On Tuesday, 19 January 2021 at 16:14:17 UTC, drug wrote:
>>>https://dlang.org/phobos/std_bitmanip.html#FloatRep
>
> Doesn't this pattern already cover all possible cases of `value` needed?
I think so. I just remembered FloatRep as a cleaner tool comp
On 1/19/21 8:14 AM, drug wrote:
> P.S. shouldn't compiler emit the error if a literal can't be represented
> lossless?
I think it would be a useful improvement.
Ali
On 1/19/21 6:04 AM, drug wrote:
> Another (low level) way is to shift mantissa left by exponent value.
Luckily, we already have a helper in Phobos:
https://dlang.org/phobos/std_bitmanip.html#FloatRep
Ali
On 1/13/21 8:17 AM, Marcone wrote:
> import std;
>
> void a(int b){
> }
>
> void main()
> {
>Variant c = 10;
>a(c); // Error
> }
>
> Need more sugar.
That can't work in a strongly statically typed language. The call a(c)
is decided at compile time but Variant is not an int at compile ti
On 1/12/21 12:58 PM, cc wrote:
> void send(T query, void delegate(T.RESPONSE) callback) {
That wants a delegate that takes a T.RESPONSE (PingResponse in this
case). However, the following lambda is in fact a template:
> send(PingQuery("helo"), (resp) {
You specify the type there an
On 1/12/21 10:44 AM, Jonathan Levi wrote:
> why does `fun` still compile?
I'm not familiar with that particular syntax, I don't know why it
compiles, and I don't know why structs are different. :) However, it
looks very much like the following *slice* syntax:
void fun(S[] s...) {
writeln
On 1/11/21 8:22 AM, zack wrote:
On Monday, 11 January 2021 at 15:25:58 UTC, Ola Fosheim Grøstad wrote:
I meant allocation... The following prints "1", so no allocation.
Just tried on Windows with Visual Studio, it prints "0". So I guess this
is platform/compiler dependent.
Yes. Earlier C++
On 1/11/21 7:27 AM, Marcone wrote:
I want to create a function that receive a tuple (need be a tuple) with
indetermined length and indetermined elements type without template. The
argument need be a tuple, but length and elements types indetermineds.
How can I make it?
With isIntanceOf in a t
On 1/10/21 7:27 PM, Paul wrote:
> On Monday, 11 January 2021 at 02:37:24 UTC, Ali Çehreli wrote:
>> >> T opCast(T)() const if (is(T : Vec!(size, S2), S2)) {
>
>> The is expression can be so complicated that I used a different
>> approach below.
>
>> if (isInstanceOfVec!T &&
>> T.init.
On 1/10/21 6:37 PM, Ali Çehreli wrote:
>// OBSERVATION: Should the cast below be S?
>converted.content[i] = cast(S2) content[i];
I take that back. Yes, it should be S2. (I've been off lately. :) )
Ali
On 1/10/21 5:09 PM, Paul wrote:
> I'll paste more of my file, I hope that's ok.
Not only ok but much appreciated. :)
>> T opCast(T)() const if (is(T : Vec!(size, S2), S2)) {
The is expression can be so complicated that I used a different approach
below. I left notes in capital letters bel
On 1/10/21 4:09 PM, Paul wrote:
> Is there a way to have additional template arguments in operator
overloads?
I haven't tried that but the following method seems to work for you. You
don't show complete code; so, I hope I came up with something that
reflects your case.
import std;
struct
Explicit with a lambda:
import std;
int heavyLoadOperation() {
writeln("Expensive!");
return uniform(0, 10);
}
void main(string[] args) {
const l = {
bool inited = false;
static int i;
if (!inited) {
i = heavyLoadOperation();
}
return i;
}();
if (args.length
On 1/9/21 12:35 PM, Ali Çehreli wrote:
> alias lightLoadOperation = memoize!heavyLoadOperation;
>
>const l = lightLoadOperation();
Well, that doesn't work the way you want but this does:
if (args.length == 1) {
writefln!"Using lazy variable: %s %s"(lightLoadOperation(),
lightLoadOper
On 1/8/21 3:10 PM, tsbockman wrote:
> On Friday, 8 January 2021 at 20:43:37 UTC, Andrey wrote:
>> Hello,
>>
>>> struct Value
>>> {
>>> int value;
>>> string data;
>>> string[] text;
The destination is immutable(char)[]. The characters cannot be changed.
We can still append but other
On 1/4/21 7:39 AM, ludo456 wrote:
> Can someone point me to an article or more explanations about that?
Joe Duffy has a very complete document contrasting various error
management strategies in the context of Midori:
http://joeduffyblog.com/2016/02/07/the-error-model/
Herb Sutter has a det
On 1/2/21 4:29 AM, Marcone wrote:
Why "lazy delegate()" need two parentheses to execute function?
lazy automatically makes a delegate that returns the type of the parameter:
void bar(lazy int i) {
writeln(i); // i is a delegate called automatically
}
Strangely, the delegateness leaks out a
On 12/31/20 8:36 AM, Rekel wrote:
🤔I'm either asking a stupid question, asking it in a wrong way, or
asking an important question. Clueless nontheless. . .
Your post was interesting to me but trying to duplicate your situation
seemed difficult.
Can you describe it with a piece of code? If th
On 12/27/20 10:24 PM, Kirill wrote:
Hello, is there a tool to measure the execution time of a function in D?
Can the GC do it?
StopWatch and benchmark():
https://dlang.org/phobos/std_datetime.html
Ali
On 12/27/20 3:12 PM, Rekel wrote:
> is there a reason to use
> either 'splitter' or 'split'? I'm not sure I see why the difference
> would matter in the end.
splitter() is a lazy range algorithm. split() is a range algorithm as
well but it is eager; it will put the results in an array that it g
On 12/26/20 4:13 PM, Rekel wrote:
I'm trying to read a file with entries seperated by '\n\n' (empty line),
with entries containing '\n'. I thought the
File.readLine(KeepTerminator, Terminator) might work, as it seems to
accept strings as terminators, since there seems to have been a thread
reg
On 12/25/20 12:59 PM, vnr wrote:
> Is there a relatively simple way to do this?
I have a minimalist photo album program that resizes images with the
help of the magickwand library:
https://github.com/acehreli/alibum
It has only the magickwand bindings that I needed.
Ali
P.S. The program
On 12/25/20 1:25 PM, sighoya wrote:
> Is generally possible to get the declaration of a type/module/value as
> string in traits?
I am probably misunderstanding it but there is the .stringof property
for all types: T.stringof.
> I want also to read
> declarations from types outside my source f
On 12/23/20 8:14 AM, frame wrote:
> That implementation
> can become very handy for some situations but for this simple case
>
> foreach (arr; [a, b]) { .. }
>
> would also work.
Absolutely.
> The difference is that the foreach loop is happen at
> runtime and will not compiled as multiple lines
On 12/23/20 1:06 AM, Godnyx wrote:
> for (ulong i = 0; i < args.length; i++) {
> if (typeof(args[i]).stringof == "string")
> printf("%s\n", args[i].toStringz);
> }
I replaced for with foreach and it worked (and I passed "prompt").
static foreach would work as wel
On 12/22/20 2:12 PM, Rekel wrote:
> Now I'm unsure how to check this, I tried to a bit using the online
> editor and a bit of pointer usage which seemed to confirm my suspicion,
> but does this mean that taking a (small) slice at the end of a
> (possibly) very large dynamic array can lead to prob
On 12/22/20 10:53 AM, Rekel wrote:> On Tuesday, 22 December 2020 at
16:56:18 UTC, Ali Çehreli wrote:
>> >[4]Foo b; /* an array of four Foos */
>>
>> [4] already has a meaning. ;)
>
> It does in that context? Do tell, I'm unaware.
An array literal with a single int element 4:
pragma(msg,
On 12/22/20 8:56 AM, Ali Çehreli wrote:
> * already means "derefence"
"dereference"
> > But now we're no longer C-like, I guess.x
That x seems to be due to my fat Emacs fingers.
Ali
On 12/22/20 6:35 AM, ag0aep6g wrote:
> Flip the pointer syntax, too:
>
> *Foo a; /* a pointer to a Foo */
I am not a language expert but I think that would make D's parsing
complicated (like C++'s < token) because * already means "derefence" in
that position. So, the parser would see *Foo
On 12/21/20 8:47 PM, Rekel wrote:
> On Monday, 30 January 2017 at 07:33:34 UTC, Ali Çehreli wrote:
>> As others have said, D's array definition is natural because unlike
>> C's inside-out (or is that outside-in?) syntax, it follows from the
>> alias syntax. Replacing History inside main with Matr
On 12/19/20 4:40 PM, Mike Parker wrote:
>> 1. Yes.keepTerminator
>
> This is because of Yes is a struct with an opDispatch template that
> "forwards" to Flag!"keepTerminator".yes. This is the preferred syntax
> and will work with any Flag parameter.
I use Flag a lot but I am always bugged by how
On 12/17/20 8:48 AM, Ali Çehreli wrote:
> There is also assumeUnique()
I meant assumeSafeAppend().
Ali
On 12/17/20 8:11 AM, IGotD- wrote:
> It's common using arrays for buffering, that means constantly adding
> elements and empty the elements.
I show an example of this at the following point in a DConf presentation:
https://youtu.be/dRORNQIB2wA?t=791
The following code:
int[] outer;
whi
On 12/15/20 2:04 PM, Dave P. wrote:
> I want to pass
> some templated functions as function pointers to some C code
As Mike Parker said, it works:
// The same thing as a C function pointer:
alias Func = long function(int);
long bar(T)(int) {
return 0;
}
Func f0 = &(bar!float);
Func d1 = &(b
On 12/7/20 4:48 AM, Dukc wrote:
On Monday, 7 December 2020 at 08:16:50 UTC, mw wrote:
r = Parallel(n_jobs=2, verbose=10)(delayed(sleep)(.2) for _ in range(10))
to print out the progress.
How to do this in D's parallel loop?
thanks.
Allocate a `shared int` before the foreach loop. In the loo
On 12/2/20 7:54 PM, Marcone wrote:
> Hi, are you Ali Çehreli author of Programming in D book?
I am.
> I learned Dlang
> by reading this book on my Kindle.
That makes me happy! :)
> If I published my source code you
> wouldn't understand.
Still, that's the most interesting part to D programme
On 12/3/20 7:18 AM, matheus wrote:
> I didn't know where to post this and I hope this is a good place.
I appreciate the question. You can start the subject with [OT] to mean
off-topic.
> work with Lazy or even Dumb
> programmers, and If yes how do you keep your sanity?
I used to blame my co-
On 12/2/20 5:46 PM, Marcone wrote:
Hello, my name is Marcone, I live in Brazil, and I have been studying
Dlang for a year. I finished my first application in Dlang with a
graphical interface in Win32api and made it available on the internet
for anyone who wants to download it. Here is the progr
On 12/2/20 12:20 PM, Ferhat Kurtulmuş wrote:
given the function:
export void ceaser_enc(char* input, ref char* output);
this compiles:
char* sezar = (new char[65]).ptr;
ceaser_enc(key, sezar);
this does not compile:
char[] sezar = new char[65];
ceaser_enc(key, sezar.ptr);
On 11/28/20 6:40 PM, Marcone wrote:
void a(T1, T2)(T1 b, T2 c){
// I need parameter "c" optional, but only (String or int). How can
I make it without overload function?
}
Since it's optional, T2 must have a default type. I made it 'int' below.
void a(T1, T2 = int)(T1 b, T2 c = T2.init)
On 11/27/20 9:01 AM, ddcovery wrote:
On Friday, 27 November 2020 at 16:40:43 UTC, ddcovery wrote:
...
* Can the lambda be transformed to a template (using T instead "int")
but avoiding function/return syntax?
This is an example using function
template qs(T){
T[] qs( T[] items ){
On 11/19/20 6:12 AM, Steven Schveighoffer wrote:
On 11/18/20 6:06 PM, ag0aep6g wrote:
int opCmp(S other)
{
import std.typecons: tuple;
return tuple(this.tupleof).opCmp(tuple(other.tupleof));
}
Ah, excellent solution! I hadn't thought of that.
-Steve
That'
On 11/18/20 7:01 AM, Vino wrote:
>Request your help on how to call a function(listFile) from another
> function(getFilelist) within the same class(GetDirlist), below is an
> example code.
That code looks unnecessarily complex to me. First of all, parallel()
already executes the loop body in
On 11/18/20 11:25 AM, Vino wrote:
> why is this
> so complicated in D where as in PHP it is simple like below
>
> PHP Code:
> class PHPclass {
>function test1 ($st) { return $st; }
>function test2 () { return $this->test1("Test"); }
> }
>
> $obj = new PHPclass();
> print_r($obj->
On 11/12/20 9:14 PM, Виталий Фадеев wrote:
Is:
wchar[] chars; // like a: "import core.sys.windows.windows;\nimport
std.conv : to;\n"
Goal:
foreach ( word; chars.byWord )
{
// ...
}
Iterating chars by Word...
How to ? ( simple, fast, low memory, beauty, perfect )
import std.stdio;
On 11/9/20 9:53 AM, k2aj wrote:
> string text = "welcome2worldinfo";
> string hg = toUpper(text[0..7] ~ "-" ~ text[7..8] ~ "-" ~ text[8..13]);
If those concatenations with the ~ operators prove to be costly at
runtime, the following range expression may be faster because it does
not allocate a
On 11/8/20 6:58 PM, rikki cattermole wrote:
> On 09/11/2020 2:58 PM, Ali Çehreli wrote:
>> Does the D GC know the complete function call stack of the C program
>> all the way up from 'main'? Is there the concept of "bottom of the
>> stack"
>
https://github.com/dlang/druntime/blob/master/src/cor
On 10/25/20 3:19 AM, rikki cattermole wrote:
On 25/10/2020 11:03 PM, Ali Çehreli wrote:
Does the GC see that local variable 'name' that is on the C side? What
I don't know is whether the GC is aware only of the stack frames of D
functions or the entire thread, which would include the C caller's
-i is a useful feature:
https://dlang.org/dmd-linux.html
Does dmd compile auto-included files separately? Does it generate
temporary object files? If so, where does it write the files? Would -i
cause race conditions on the file system?
Thank you,
Ali
On 11/1/20 1:11 PM, Anonymouse wrote:
On Sunday, 1 November 2020 at 20:33:15 UTC, Marcone wrote:
I need a most simple and easy example to understand UDA.
https://ddili.org/ders/d.en/uda.html
The difficulty of understanding UDAs comes up from time to time.
Obviously, there are some crucial w
On 10/29/20 10:16 AM, H. S. Teoh wrote:
> Module-level immutable can be initialized either as part of the
> declaration:
>
>immutable int x = 1;
To add, the expression can be a call to a function that need not return
immutable, as long as it is pure, which can be inferred by the compiler
f
On 10/28/20 3:07 PM, H. S. Teoh wrote:
A shared immutable is initialized at compile-time,
To prevent a misunderstanding, immutable can be initialized at run time
as well. On the other hand, immutable initialized at compile time was
surprising to me when I learned it recently:
import std;
On 10/28/20 5:55 PM, matheus wrote:
On Wednesday, 28 October 2020 at 22:07:06 UTC, H. S. Teoh wrote:
... (This is why it's a bad idea to use enum with an array literal,
because every time it's referenced you get a new copy of the array.)
...
Could you please give an example (Snippet) about th
On 10/28/20 9:30 AM, Paul wrote:
> On Wednesday, 28 October 2020 at 15:40:23 UTC, aberba wrote:
>> Have you tries .values() function? dictionary.values.sort()
>
> Thanks aberba. Yes, that was my first attempt!
>
> If my terminology is correct that gives me a "range" of sorted VALUES.
No, both .v
On 10/25/20 12:29 PM, IGotD- wrote:
What I discovered is that remove doesn't really remove size number of
bytes but also removed entire multibyte characters and consider that one
step. The result was of course that I got out of bounds exceptions as it
went past the end.
This is the infamous
701 - 800 of 2571 matches
Mail list logo