why?
Because an empty string is, by default, represented by an empty
slice of the null pointer.
I don't program in D. I just read from time to time posts in the
D forum because of the good quality of what people write. So, I'm
not proficient in D, but in general internals should not boil up
Hello,
I'm looking for a way to pass parameters to a function called by
a fiber. Starting a fiber works like this:
int main()
{
auto fiber = new Fiber(&myFunc);
fiber.call();
fiber.call();
return 0;
}
void myFunc() {
writeln("Fiber called");
Fiber.yield();
writeln(
On Monday, 3 October 2022 at 10:13:09 UTC, Rene Zwanenburg wrote:
On Monday, 3 October 2022 at 08:10:43 UTC, Bienlein wrote:
My question is whether someone has an idea for a better
solution.
You can pass a lambda to the fiber constructor. For example:
```
void fiberFunc(int i)
{
writeln(
Hello,
I get the error "`addToBiz(T)(Biz!T biz)` is not an lvalue and
cannot be modified" when compiling the code below. Can't find a
way how to do it right. Am a D newbie and would appreciate some
help.
Thank you, Bienlein
class Biz(T) {
private T value;
this(T value) {
On Wednesday, 8 November 2023 at 16:47:02 UTC, Paul Backus wrote:
On Wednesday, 8 November 2023 at 16:30:49 UTC, Bienlein wrote:
...
The actual problem here is that you can't take the address of a
template without instantiating it first. To make your example
work, replace `&addToBiz` with `&add
On Thursday, 9 November 2023 at 09:40:47 UTC, Bienlein wrote:
On Wednesday, 8 November 2023 at 16:47:02 UTC, Paul Backus
wrote:
On Wednesday, 8 November 2023 at 16:30:49 UTC, Bienlein wrote:
...
The actual problem here is that you can't take the address of
a template without instantiating it fi
On Thursday, 9 November 2023 at 10:14:46 UTC, Bienlein wrote:
On Thursday, 9 November 2023 at 09:40:47 UTC, Bienlein wrote:
On Wednesday, 8 November 2023 at 16:47:02 UTC, Paul Backus
wrote:
On Wednesday, 8 November 2023 at 16:30:49 UTC, Bienlein wrote:
...
The actual problem here is that you ca
On Thursday, 10 October 2019 at 10:08:14 UTC, H. S. Teoh wrote:
On Thu, Oct 10, 2019 at 09:59:49AM +0100, Russel Winder via
Digitalmars-d-learn wrote:
On Wed, 2019-10-09 at 11:12 -0700, H. S. Teoh via
Digitalmars-d-learn wrote: […]
> Actually, std.functional is somewhat of a misnomer. It
> most
On Thursday, 10 October 2019 at 16:05:13 UTC, bachmeier wrote:
On Thursday, 10 October 2019 at 08:59:49 UTC, Russel Winder
wrote:
My impressions is that the complaints about Scala are similar
to C++: too many features that clash with one another and make
the language complicated, plus extreme
On Tuesday, 18 February 2020 at 12:43:22 UTC, Adnan wrote:
What is the alternative to C++'s friend functions in D?
module stable_matching;
alias FemaleID = int;
alias MaleID = int;
class Person {
string name;
int id;
}
class Male : Person {
this(string name = "Unnamed Male") {
On Wednesday, 27 May 2020 at 11:40:00 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote:
On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote:
Could you please elaborate why checked exceptions are more
annoying?
For me, it's because they require all funct
Hello,
I allocate some instance of class C manually and then free the
memory again:
class C {
int num;
~this() {
writeln("~this");
}
}
void foo() // @nogc
{
auto mem = cast(C)malloc(__traits(classInstanceSize, C));
auto c = empl
On Thursday, 19 August 2021 at 07:30:38 UTC, Bienlein wrote:
Hello,
I allocate some instance of class C manually and then free the
memory again:
class C {
int num;
~this() {
writeln("~this");
}
}
void foo() // @nogc
{
auto mem = cast(C
This works, vit. Thanks! I thought it wouldn't, because your code
still makes use of embrace. But it somehow worked, although I
don't understand why ... ;-).
I also added a constructor using the same approach as your
destructor and this also worked:
this(int otherNum) @nogc {
t
On Tuesday, 13 November 2018 at 07:10:26 UTC, 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 Friday, 16 November 2018 at 02:18:11 UTC, Ranjan wrote:
On Thursday, 15 November 2018 at 17:03:55 UTC, Andrea Fontana
wrote:
On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote:
This is my first time on the Dlang forum. I like the language
but my usecase is a bit different.
I want
On Wednesday, 13 September 2017 at 07:51:19 UTC, John Burton
wrote:
Is there any threadsafe queue in the standard library?
I've not been able to find anything but thought I'd check
before making my own.
I want to be able to assemble messages (Which are just streams
of bytes) in one thread int
On Thursday, 21 December 2017 at 18:45:27 UTC, Adam D. Ruppe
wrote:
On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote:
When the scoped destruction of structs isn't an option,
RefCounted!T seems to be a less evil alternative than an
unreliable class dtor. :-/
Alas, RefCounted doe
One key difference is that coroutines won't make your programs
run faster. It is a modelling mechanism that can simplify your
programs where you otherwise would have to implement a state
machine.
This is also my impression when I look at this code (see
http://www.99-bottles-of-beer.net/lang
Hello,
I'm looking for a way to do some kind of RPC in D. Some way of
being able to say aFoo.bar(int i, ...) with receiver object and
method being marshalled at the sender's site and being
unmarshalled and invoked at the receiver's site. Any hints
appreciated.
Thanks, Bienlein
What I want to do is some little framework that allows
Julia-style (julialang.org) distributed computation: send some
function invocation to some other machine along with the numbers
to be crunched and get the result back.
vibe.web.rest server/client combo is effectively RPC over
HTTP/json
What data load profile do you expect? Vibe is tuned to handle
thousands simultaneous incoming light requests (milliseconds),
while distributed computing works better with exclusive heavy
requests, at least minutes of work worth, BOINC uses hours
worth work items.
Communication will be bi-di
On Saturday, 21 June 2014 at 18:22:54 UTC, Paul wrote:
I wrote some (JSONRPC and TXTRPC) and used them with vibe. I
can send you via email
Hi Paul, alternatively you could upload your code to GitHub or
some similar place and place the link here. Then you also have a
means to "proof" that the
On Monday, 23 June 2014 at 01:16:49 UTC, Evan Davis wrote:
As the subject says, I would like to pass around an array of
functions. The trick is, that the functions have different type
signatures. Is there a way to put the two functions
int foo(int a, int b);
bool bar(bool a, bool b);
into one
There is also a Semaphore and Barrier class:
http://dlang.org/phobos/core_sync_barrier.html
http://dlang.org/phobos/core_sync_semaphore.html
Hello,
I was having a look at the new nogc annotation and therefore
wrote some code that creates an instance on the heap bypassing
the GC (code adapted from http://dpaste.dzfl.pl/2377217c7870).
Problem is that calls to call the class' constructor, destructor
and others can't be called anymore
On Sunday, 24 August 2014 at 08:48:03 UTC, bearophile wrote:
Perhaps there are ways, but note that @nogc is meant mostly for
stack-allocation.
Ah, I missed that. Thanks for telling me. I changed nogcDel now
to null out the deallocated object:
void nogcDel(T)(ref T obj)
{
import core.std
Hello,
the code below compiles and runs fine. However, when I change
Payload from struct to class I get compiler errors:
Error 1 Error: template instance
std.typecons.RefCounted!(Payload,
cast(RefCountedAutoInitialize)1) does not match template
declaration RefCounted(T, RefCountedAutoInitia
On Tuesday, 26 August 2014 at 06:01:25 UTC, uri wrote:
RefCounted does not work with classes. Classes are reference
types already.
Yep, that's the problem. I also got some suspicion, then surfed
the Internet and found the information about it. Thanks for
explaining the error message to me. N
Hello,
does anyone know of a List/Set/Map implementation that does not
rely on the GC? The would be the last thing I need for D to be
really happy with it ;-)
Thanks, Bienlein
Thanks for the replies. This looks good. I meanwhile found
http://dsource.org/projects/dcollections But it seems to be
GC-based just like Tango ... ;-(.
31 matches
Mail list logo