On Wed, 09 Feb 2011 23:01:47 -0500, Andrej Mitrovic wrote:
I'm trying to use the std.md5.sum method. It takes as an argument a
digest to output the hash to, and the second argument is plain data.
So I'm trying to read an entire file at once. I thought about using
rawRead, but I get a
I am trying to write the web framework(but not to write, to gain experience.).
Maybe the framework can has got a MVC desing pattern. But first, the D2 is not
has got for the web library and I am decided write to library for web.
I am writed a function for post and get methods. (I am not tried
On Thu, 10 Feb 2011 04:29:21 -0500, canalpay wrote:
I am trying to write the web framework(but not to write, to gain
experience.). Maybe the framework can has got a MVC desing pattern. But
first, the D2 is not has got for the web library and I am decided write
to library for web.
I am
Greetings All
I have learnt that D has only one casting operator and that is 'cast'.
The same operator assumes different functionality depending on the
context in which it he being used.
Now I have a situation where I have to downcast an object and I am
sure of the objects type and thereby I am
d coder:
I have learnt that D has only one casting operator and that is 'cast'.
The same operator assumes different functionality depending on the
context in which it he being used.
Walter likes this design, I presume he thinks it's simpler.
Now I have a situation where I have to downcast
On Thu, 10 Feb 2011 11:54:02 +, Lars T. Kyllingstad wrote:
On Thu, 10 Feb 2011 16:44:12 +0530, d coder wrote:
Greetings All
I have learnt that D has only one casting operator and that is 'cast'.
The same operator assumes different functionality depending on the
context in which it he
On 02/09/2011 10:15 PM, Steven Schveighoffer wrote:
On Wed, 09 Feb 2011 15:58:13 -0500, bearophile bearophileh...@lycos.com wrote:
Sean Eskapp:
so is there a way to invoke a GC cleanup in some way?
http://www.digitalmars.com/d/2.0/phobos/core_memory.html#minimize
This attempts to
Lars T. Kyllingstad:
Ok, bearophile's solution is better, because it has fewer casts.
And your solution was better because it's inside a function :-)
I forgot you can cast to void*. So here's an improved version, with some
template constraints to make sure it's only used for class types:
Hello,
Implicite deref of struct pointers on member access works fine for data,
methods, even special methods with language semantics like opEquals (see
example below).
But I cannot have 'in' work with method opIn_r. I get:
Error: rvalue of in expression must be an associative array, not
Thanks Lars and Bearophile, I will give it a try.
I understand that static downcasting is dangerous. But there are
places where efficiency is paramount and you are sure that the casting
is safe. So I wholeheartedly second your proposal to have the stuff in
phobos.
Regards
- Cherry
On Thu, 10 Feb 2011 07:34:53 -0500, spir denis.s...@gmail.com wrote:
On 02/09/2011 10:15 PM, Steven Schveighoffer wrote:
On Wed, 09 Feb 2011 15:58:13 -0500, bearophile
bearophileh...@lycos.com wrote:
Sean Eskapp:
so is there a way to invoke a GC cleanup in some way?
On Thu, 10 Feb 2011 08:02:08 -0500, d coder dlang.co...@gmail.com wrote:
Thanks Lars and Bearophile, I will give it a try.
I understand that static downcasting is dangerous. But there are
places where efficiency is paramount and you are sure that the casting
is safe. So I wholeheartedly second
On 02/09/2011 11:05 PM, Steven Schveighoffer wrote:
On Wed, 09 Feb 2011 16:41:25 -0500, useo u...@start.bg wrote:
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel
useo:
I just have a problem with my variables.
For example... my class/template just looks like:
class
On Thu, 10 Feb 2011 07:59:06 -0500, spir denis.s...@gmail.com wrote:
Hello,
Implicite deref of struct pointers on member access works fine for data,
methods, even special methods with language semantics like opEquals (see
example below).
But I cannot have 'in' work with method opIn_r. I
On Thu, 10 Feb 2011 08:39:13 -0500, spir denis.s...@gmail.com wrote:
On 02/09/2011 11:05 PM, Steven Schveighoffer wrote:
I don't think you want templates. What you want is a tagged union (and
a struct
is MUCH better suited for this):
// untested!
struct Example
{
private
{
bool
Sean Eskapp wrote:
I'm having an unfortunate DSFML issue, where failing to free objects
like Images or Sprites causes exceptions to eventually be thrown.
Calling the built-in member dispose() causes access violations, so I
assume it's not for programmer use.
However, I need the resources to be
Johannes Pfau wrote:
Sean Eskapp wrote:
I'm having an unfortunate DSFML issue, where failing to free objects
like Images or Sprites causes exceptions to eventually be thrown.
Calling the built-in member dispose() causes access violations, so I
assume it's not for programmer use.
However, I need
I implemented all I wanted and it works perfectly ;).
But I'm using the if (is(T == delegate) || is(T == function))-
statement in another class/template.
class Example(T) if (is(T == delegate) || is(T == function)) {
...
}
Now, when I declare Example!(void function()) myVar; I always get:
On Thu, 10 Feb 2011 09:09:03 -0500, useo u...@start.bg wrote:
I implemented all I wanted and it works perfectly ;).
But I'm using the if (is(T == delegate) || is(T == function))-
statement in another class/template.
class Example(T) if (is(T == delegate) || is(T == function)) {
...
}
Now,
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel
On Thu, 10 Feb 2011 09:09:03 -0500, useo u...@start.bg wrote:
I implemented all I wanted and it works perfectly ;).
But I'm using the if (is(T == delegate) || is(T == function))-
statement in another class/template.
== Auszug aus useo (u...@start.bg)'s Artikel
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel
On Thu, 10 Feb 2011 09:09:03 -0500, useo u...@start.bg wrote:
I implemented all I wanted and it works perfectly ;).
But I'm using the if (is(T == delegate) || is(T ==
On Thu, 10 Feb 2011 09:48:14 -0500, useo u...@start.bg wrote:
I created a complete, new file with the following code:
module example;
void main(string[] args) {
Example!(void function()) myVar;
}
class Example(T) if (is(T == delegate) || is(T == function)) {
}
And what I get is:
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel
On Thu, 10 Feb 2011 09:48:14 -0500, useo u...@start.bg wrote:
I created a complete, new file with the following code:
module example;
void main(string[] args) {
Example!(void function()) myVar;
}
class
On 02/10/2011 01:38 PM, bearophile wrote:
Lars T. Kyllingstad:
Ok, bearophile's solution is better, because it has fewer casts.
And your solution was better because it's inside a function :-)
I forgot you can cast to void*. So here's an improved version, with some
template constraints to
On 2/10/11, Lars T. Kyllingstad public@kyllingen.nospamnet wrote:
To read an entire file at once, you should use std.file.read(), or
std.file.readText() if it's an UTF encoded text file.
I missed that method while browsing through the docs. Thanks.
There are actually three modules for file
On Thu, 10 Feb 2011 11:38:40 -0500, spir denis.s...@gmail.com wrote:
On 02/10/2011 01:38 PM, bearophile wrote:
Is a pair of similar staticDownCast(), staticUpCast() fit for Phobos?
But I have never needed upcast in D as of now. What are common use cases?
Aren't all upcasts static
Hey guys,
I'm trying to iterate over an enumeration which contains strings like
the this:
enum FileName : string {
file1 = file1.ext,
file2 = file2.ext
}
I already found this article: http://lists.puremagic.com/pipermail/
digitalmars-d/2007-July/021920.html but it's an enum which contains
On 02/10/2011 02:51 PM, Steven Schveighoffer wrote:
On Thu, 10 Feb 2011 08:39:13 -0500, spir denis.s...@gmail.com wrote:
On 02/09/2011 11:05 PM, Steven Schveighoffer wrote:
I don't think you want templates. What you want is a tagged union (and a struct
is MUCH better suited for this):
//
On 02/10/2011 02:39 PM, Steven Schveighoffer wrote:
On Thu, 10 Feb 2011 07:59:06 -0500, spir denis.s...@gmail.com wrote:
Hello,
Implicite deref of struct pointers on member access works fine for data,
methods, even special methods with language semantics like opEquals (see
example below).
But
On Thu, 10 Feb 2011 12:04:28 -0500, spir denis.s...@gmail.com wrote:
On 02/10/2011 02:51 PM, Steven Schveighoffer wrote:
On Thu, 10 Feb 2011 08:39:13 -0500, spir denis.s...@gmail.com wrote:
On 02/09/2011 11:05 PM, Steven Schveighoffer wrote:
I don't think you want templates. What you want
Nrgyzer Wrote:
Hey guys,
I'm trying to iterate over an enumeration which contains strings like
the this:
enum FileName : string {
file1 = file1.ext,
file2 = file2.ext
}
I already found this article: http://lists.puremagic.com/pipermail/
digitalmars-d/2007-July/021920.html but it's
== Auszug aus Jesse Phillips (jessekphillip...@gmail.com)'s Artikel
Nrgyzer Wrote:
Hey guys,
I'm trying to iterate over an enumeration which contains strings
like
the this:
enum FileName : string {
file1 = file1.ext,
file2 = file2.ext
}
I already found this article:
Michel Fortin napisał:
Thanks for doing this. Is it approved by Walter?
Depends on what you mean by approved.
He commented once on the newsgroup after I posted an earlier version of
the patch, saying I should add tests for type deduction and some other
stuff. This change his
On Thu, 10 Feb 2011 14:45:14 -0500, Tomek Sowiński j...@ask.me wrote:
Michel Fortin napisał:
Thanks for doing this. Is it approved by Walter?
Depends on what you mean by approved.
He commented once on the newsgroup after I posted an earlier version of
the patch, saying I should add tests
On 02/10/2011 08:22 PM, Jesse Phillips wrote:
Nrgyzer Wrote:
Hey guys,
I'm trying to iterate over an enumeration which contains strings like
the this:
enum FileName : string {
file1 = file1.ext,
file2 = file2.ext
}
I already found this article: http://lists.puremagic.com/pipermail/
spir Wrote:
On 02/10/2011 08:22 PM, Jesse Phillips wrote:
enum FileName : string {
file1 = file1.ext,
file2 = file2.ext
}
void main(string args[])
{
foreach(a; __traits(allMembers, FileName))
writeln(mixin(FileName. ~ a));
}
Why the mixin? Is it (just) to
On 02/10/2011 07:43 PM, Stewart Gordon wrote:
On 10/02/2011 12:59, spir wrote:
Hello,
Implicite deref of struct pointers on member access works fine for data,
methods, even
special methods with language semantics like opEquals (see example below).
But I cannot have 'in' work with method
I don't have answers to your other questions.
On 02/10/2011 03:25 PM, spir wrote:
unittest {
auto i = 1;
auto s = i;
It works if you define s as:
enum s = i;
writeln(mixin(i)); // compiler happy up to here -- 1
writeln(mixin(s)); // compiler unhappy -- Error: argument to mixin
//
Is there a way to statically assert compilation of an expression failed *with a
certain message*? I want to check my static asserts trip when they should.
--
Tomek
Tomek Sowiñski:
Is there a way to statically assert compilation of an expression failed *with
a certain message*? I want to check my static asserts trip when they should.
I have asked something like this a lot of time ago, but I don't know a way to
do it. You are able to statically assert
On 02/11/2011 01:02 AM, Ali Çehreli wrote:
I don't have answers to your other questions.
On 02/10/2011 03:25 PM, spir wrote:
unittest {
auto i = 1;
auto s = i;
It works if you define s as:
enum s = i;
writeln(mixin(i)); // compiler happy up to here -- 1
writeln(mixin(s)); //
On Thursday, February 10, 2011 16:12:01 Tomek Sowiński wrote:
Is there a way to statically assert compilation of an expression failed
*with a certain message*? I want to check my static asserts trip when they
should.
You mean like
static assert(0, We have a failure, Captain!);
If a static
bearophile napisał:
Is there a way to statically assert compilation of an expression failed
*with a certain message*? I want to check
my static asserts trip when they should.
I have asked something like this a lot of time ago, but I don't know a way to
do it. You are able to
How's this?
import std.stdio;
import std.conv;
void staticAssert(alias exp, string message, string file = __FILE__,
int line = __LINE__)()
{
static if (!exp)
{
pragma(msg, file ~ :( ~ to!string(line) ~ ) ~
staticAssert: ~ to!string(message));
assert(0);
}
}
void
I've managed to screw up the colon placement though, here's a quick fix:
import std.stdio;
import std.conv;
void staticAssert(alias exp, string message, string file = __FILE__,
int line = __LINE__)()
{
static if (!exp)
{
pragma(msg, file ~ ( ~ to!string(line) ~ ): ~
Tomek S.:
Static catch, yeah. But I'd be content with traits__(fails, expr, msg) which
seems tractable.
Asking for new features in this newsgroup is not so useful. You may add it to
bugzilla...
Bye,
bearophile
spir Wrote:
But in your example the symbol a does not look like a constant, instead it
the
loop variable. Do, how does it work?
Magic.
No really, the best I can tell is that the compiler will try to run the foreach
loop at compile-time if there is something in the body that must be
On 10.02.2011 10:29, canalpay wrote:
I am trying to write the web framework(but not to write, to gain experience.).
Maybe the framework can has got a MVC desing pattern. But first, the D2 is not
has got for the web library and I am decided write to library for web.
I am writed a function for
48 matches
Mail list logo