On Friday, January 21, 2011 15:23:37 Andrej Mitrovic wrote:
> Sorry, I should be careful with the word side-effects. What I meant
> was the newly spawned thread does its own job that the main thread
> doesn't care much about. It doesn't touch main's state or any shared
> variables. It does some wor
Sean Eskapp wrote:
> The following code yields results as commented.
>
> import std.stdio;
>
> class A
> {
>int b;
> }
>
> void main()
> {
>const A a = new A;
>writeln(typeof(a).stringof); // const(A)
>writeln(typeof(a.b).stringof); // const(int)
>
>writeln((const A).stringof);
The following code yields results as commented.
import std.stdio;
class A
{
int b;
}
void main()
{
const A a = new A;
writeln(typeof(a).stringof); // const(A)
writeln(typeof(a.b).stringof); // const(int)
writeln((const A).stringof); // const(A)
wr
On 01/21/2011 09:56 PM, Jonathan M Davis wrote:
On Friday, January 21, 2011 05:18:15 tamir wrote:
or what's the differents between theese two:
void transactionalCreate(string filename) {
string tempFilename = filename - ".fragment";
scope(success) {
std.file.rename(tempFilename, filen
Sorry, I should be careful with the word side-effects. What I meant
was the newly spawned thread does its own job that the main thread
doesn't care much about. It doesn't touch main's state or any shared
variables. It does some work other than return a value. But the
function I wanted the new threa
Jesse Phillips:
> So I do believe it should be const, but between the other priorities, and
> possible signature change for toString, it isn't done yet.
There also the idea of introducing the writeTo() standard method, that's neat
:-)
Bye,
bearophile
On Friday, January 21, 2011 14:12:18 Andrej Mitrovic wrote:
> import std.stdio;
> import std.concurrency;
>
> void foo(int var)
> {
> }
>
> bool bar(int var)
> {
> return true;
> }
>
> void barWrapper(int var)
> {
> bar(var);
> }
>
> void main()
> {
> spawn(&foo, 1);
> spawn(&ba
On Friday, January 21, 2011 14:49:44 Andrej Mitrovic wrote:
> When there are multiple calls that can fail, and where I have to do
> clean-up code in a certain order and under certain conditions I use
> scope(exit). For example:
>
> import std.stdio;
> import std.exception;
>
> void main()
> {
>
On Friday, January 21, 2011 13:02:56 Tom wrote:
> Hi, I'm trying to override Object's toString. I've noted it isn't a
> const method, namely:
>
> string toString() const;
>
> This cause me troubles when using it on a const reference.
>
> Shouldn't it be const?
>
> Thanks,
> Tom;
It's a long-st
When there are multiple calls that can fail, and where I have to do
clean-up code in a certain order and under certain conditions I use
scope(exit). For example:
import std.stdio;
import std.exception;
void main()
{
foo();
}
enum NoError = true;
bool Initialize() { return true; }
bool Start
Tom Wrote:
> Hi, I'm trying to override Object's toString. I've noted it isn't a
> const method, namely:
>
> string toString() const;
>
> This cause me troubles when using it on a const reference.
>
> Shouldn't it be const?
>
> Thanks,
> Tom;
Phobos hasn't become very const aware. There have
Sean Eskapp Wrote:
>
> > templates:
>
> > void foo(T)(T, void delegate(T) fn)
> > {
> > }
>
> > This parameterizes foo based on T, which could be A, const A, or int, or
> > whatever works to compile the function.
>
> What if the parameters are more general, for instance the first parameter is
import std.stdio;
import std.concurrency;
void foo(int var)
{
}
bool bar(int var)
{
return true;
}
void barWrapper(int var)
{
bar(var);
}
void main()
{
spawn(&foo, 1);
spawn(&barWrapper, 1);
spawn(&bar, 1);
}
Errors:
testSpawn.d(24): Error: template std.concurrency.spawn(T.
Hi, I'm trying to override Object's toString. I've noted it isn't a
const method, namely:
string toString() const;
This cause me troubles when using it on a const reference.
Shouldn't it be const?
Thanks,
Tom;
On Friday, January 21, 2011 05:18:15 tamir wrote:
> or what's the differents between theese two:
> void transactionalCreate(string filename) {
> string tempFilename = filename - ".fragment";
> scope(success) {
> std.file.rename(tempFilename, filename);
> }
> auto f = File(tempFilename,
On Friday, January 21, 2011 12:36:23 Ary Manzana wrote:
> On 1/20/11 5:48 PM, Jacob Carlborg wrote:
> > On 2011-01-20 21:34, Steven Schveighoffer wrote:
> >> On Thu, 20 Jan 2011 15:03:55 -0500, Jacob Carlborg wrote:
> >>> On 2011-01-20 19:18, Steven Schveighoffer wrote:
> On Thu, 20 Jan 2011
> templates:
> void foo(T)(T, void delegate(T) fn)
> {
> }
> This parameterizes foo based on T, which could be A, const A, or int, or
> whatever works to compile the function.
What if the parameters are more general, for instance the first parameter is
always a Foo, the second is a delegate whi
On 1/20/11 5:48 PM, Jacob Carlborg wrote:
On 2011-01-20 21:34, Steven Schveighoffer wrote:
On Thu, 20 Jan 2011 15:03:55 -0500, Jacob Carlborg wrote:
On 2011-01-20 19:18, Steven Schveighoffer wrote:
On Thu, 20 Jan 2011 13:07:58 -0500, Jacob Carlborg wrote:
On 2011-01-20 15:02, Steven Schve
On Fri, 21 Jan 2011 09:08:58 -0500, Sean Eskapp
wrote:
How does one avoid code duplication in a snippet code like this:
class A{}
void foo(const A, void delegate(const A) fn)
{
// some stuff
// ...
// ...
}
void foo(A, void delegate(A) fn)
{
// exact same st
On Fri, 21 Jan 2011 10:09:18 -0500, Steven Schveighoffer
wrote:
On Fri, 21 Jan 2011 10:04:56 -0500, Adam Conner-Sax
wrote:
Thanks!
I tried to apply that patch and rebuild phobos (I changed the file,
remade
libphobos2.a, put it in /usr/local/lib). That worked but I still get
my erro
On Fri, 21 Jan 2011 08:18:15 -0500, tamir wrote:
or what's the differents between theese two:
void transactionalCreate(string filename) {
string tempFilename = filename - ".fragment";
scope(success) {
std.file.rename(tempFilename, filename);
}
auto f = File(tempFilename, "w");
}
and
On Fri, 21 Jan 2011 10:04:56 -0500, Adam Conner-Sax
wrote:
Thanks!
I tried to apply that patch and rebuild phobos (I changed the file,
remade
libphobos2.a, put it in /usr/local/lib). That worked but I still get my
error. I
might have done the applying or rebuilding wrong though, especia
Thanks!
I tried to apply that patch and rebuild phobos (I changed the file, remade
libphobos2.a, put it in /usr/local/lib). That worked but I still get my error.
I
might have done the applying or rebuilding wrong though, especially since once I
did that, even with the casting away of shared, I g
On 01/21/2011 02:18 PM, tamir wrote:
or what's the differents between theese two:
void transactionalCreate(string filename) {
string tempFilename = filename - ".fragment";
scope(success) {
std.file.rename(tempFilename, filename);
}
auto f = File(tempFilename, "w");
}
and:
void tr
On Thu, 20 Jan 2011 21:14:06 -0500, Adam Conner-Sax
wrote:
The following code:
import std.algorithm;
class Foo {
private:
int id_;
public:
shared int id() const { return id_; }
}
static bool compare(in shared(Foo) a, in shared(Foo) b)
{
return (a.id() < b.id());
}
void main()
{
How does one avoid code duplication in a snippet code like this:
class A{}
void foo(const A, void delegate(const A) fn)
{
// some stuff
// ...
// ...
}
void foo(A, void delegate(A) fn)
{
// exact same stuff, with different qualifiers
// ...
// ...
or what's the differents between theese two:
void transactionalCreate(string filename) {
string tempFilename = filename - ".fragment";
scope(success) {
std.file.rename(tempFilename, filename);
}
auto f = File(tempFilename, "w");
}
and:
void transactionalCreate(string filename) {
strin
Speaking of COM.. has anyone successfully used COM interfaces in D2?
I once tried to create a DDraw proxy dll but I can't remember how good it
worked.
https://bitbucket.org/trass3r/ddrawproxy
28 matches
Mail list logo