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
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 instantiati
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 `&addTo
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;
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
oo.i++;
Fiber.yield();
writeln("foo: ", foo.i);
}
But this solution is a bit clumsy. It's kind of programming with
global variables.
My question is whether someone has an idea for a better solution.
Thank you, Bienlein
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
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 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
that I can create some generic
function that calls the destructor and then free for any kind of
class?
Thanks, Bienlein
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
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 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 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 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 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 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
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
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 ... ;-(.
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
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
, RefCountedAutoInitialize autoInit =
RefCountedAutoInitialize.yes) if (!is(T ==
class)) C:\Users\Nutzer\Windows Ordner\Documents\Visual Studio
2013\Projects\RefCountedScratch\RefCountedScratch\main.d 26
I tried many things, but nothing did it. Any help appreciated :-).
Thanks, Bienlein
import std.stdio;
import
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
this? Then the test.x = 456; did not
cause a protection violation although the instance was
deallocated before calling nogcDel. Something with the
deallocation in nogcDel seems not to work. Some hint appreciated
on this. When calling delete t the protection violation happens
on the next line as expected.
Thanks a lot, Bienlein
There is also a Semaphore and Barrier class:
http://dlang.org/phobos/core_sync_barrier.html
http://dlang.org/phobos/core_sync_semaphore.html
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
quot; that the code is your work along with the date
of publication.
-- Bienlein
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
being a Smalltalk/Java developer (only played with C++
when studying) I have to stick to what is easier to use. It would
be a fun & leisure & learning project anyway...
Regards, Bienlein
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
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
On Friday, 4 April 2014 at 19:56:14 UTC, Jesse Phillips wrote:
On Friday, 4 April 2014 at 15:13:25 UTC, Bienlein wrote:
What I was actually looking for was how to get this to work:
immutable int b = if(1 == 1) { return 123; } else { return
456; };
But I'm happy enough with the sol
On Friday, 4 April 2014 at 13:53:33 UTC, bearophile wrote:
If your D function has one argument, you have to give it one
argument, even if it doesn't have a visible name and it's
unused.
Ah! Admittedly, I though it's the return type .. So this works
now:
immutable int b = () {
if(1 ==
Thanks so far. I have another one, though. Not trying to tease
people, I really don't know ;-).
This compiles and runs:
immutable int a = (int val) {
if(1 == 1) {
return val;
} else {
return 456;
}
}(123);
writeln(a);
Whereas th
"auto" is used to declare an instance, or an object.
"alias" is used to declare a name.
What you are currently doing is saying "the function
TCopy!(int, int) can now be refered to as myCopy". You aren't
actually creating any data.
All right, thanks. Then I create an instance:
auto myCopy =
t compile. My
question is why defining auto does not work. I would consider
this more intuitive.
Thanks, Bienlein
;
int delegate(int) dg = { value => return value + a + 3; };
auto result = dg(123);
Unhappily, the code above doesn't compile. Tried various things,
looked for samples on the D hompepage and in the book by Çehreli,
but had no luck.
Some hints appreciated.
Thanks, Bienlein
On Tuesday, 4 March 2014 at 06:31:24 UTC, Timothee Cour wrote:
that gives tid of spawned thread, not 'self'.
The link you mentioned says it is stored in the special variable
thisTid.
't have (except implicits, which is a good thing not to
have). On the contrary D has immutable types and pure functions.
Things that aren't possible in Scala due to limitations of the
JVM or need for interoperability.
-- Bienlein
I asked something similar some days ago. Maybe this provides some
information tat is helpful to you:
http://forum.dlang.org/thread/mekdjoyejtfpafpcd...@forum.dlang.org
or am I messing
something up?
Thanks for shedding any light on this for me ;-).
Regards, Bienlein
27;t compile. I guess it is because it could
reference data outside the thread which would result in the
thread reaching into memory of the calling thread.
I don't really understand why foo has to be static to compile.
But this is really nice now :-).
-- Bienlein
= &foo;
send(tid, dg);
}
My solution of course doesn't compile.
Thanks for any hint, Bienlein
C is null
Very interesting. Does this go beyond annotations in Java? Just
out of curiosity, no language war intended.
-- Bienlein
thanks a lot. I like this pure feature and was already
disappointed. Scala doesn't have it (has to remain interoperable
with Java), so I was really happy to see it in D. Your answer
saved my day :-)
-- Bienlein
compiles and runs which I find confusing. I assumed
that changing an inst var by a pure function is considered
creating a side efect. But the compiler has no problems with this.
Am I getting something wrong here? Thanks for any hints.
Regards, Bienlein
46 matches
Mail list logo