On Tuesday, 16 April 2013 at 21:09:42 UTC, gedaiu wrote:
On Monday, 15 April 2013 at 19:25:19 UTC, simendsjo wrote:
On Monday, 15 April 2013 at 17:34:07 UTC, gedaiu wrote:
Hi,
Can anyone help me to connect to mysql from D?
Thanks!
You can use Steve Teales native library. The most
On 04/17/2013 10:29 PM, Ali Çehreli wrote:
Yes but as I said I am not sure how useful or needed this whole thing is.
The language handles copy, move, and assignment for structs. takeOver() seems
to
be a primitive operation for classes.
Could you expand a bit on that? Just that I'm not
I know this will not be changed, I just want to understand why it
is as it is.
My naive thought is that consistency is the best scheme and that
everything should have been passed by value or everything by
reference unless the user specifies otherwise.
I have read a comment by Andrei that
On 2013-04-18 15:37, ixid wrote:
I know this will not be changed, I just want to understand why it is as
it is.
My naive thought is that consistency is the best scheme and that
everything should have been passed by value or everything by reference
unless the user specifies otherwise.
I have
An array is represent using a struct with a pointer to the
array data and the length, like this:
struct Array
{
void* ptr;
size_t length;
}
The struct is passed by value, but since it contains a pointer
to the data it will be passed by reference. Note that if you do:
void foo (int[]
On 2013-04-18, 16:20, ixid wrote:
An array is represent using a struct with a pointer to the array data
and the length, like this:
struct Array
{
void* ptr;
size_t length;
}
The struct is passed by value, but since it contains a pointer to the
data it will be passed by reference.
On Thursday, 18 April 2013 at 13:37:45 UTC, ixid wrote:
I know this will not be changed, I just want to understand why
it is as it is.
My naive thought is that consistency is the best scheme and
that everything should have been passed by value or everything
by reference unless the user
On 04/18/2013 07:20 AM, ixid wrote:
Jacob Carlborg said:
An array is represent using a struct with a pointer to the array data
and the length, like this:
struct Array
{
void* ptr;
size_t length;
}
The terms array and slice are commonly interchanged but I think it
adds to the
On Thu, 18 Apr 2013 11:26:22 -0400, Maxim Fomin ma...@maxim-fomin.ru
wrote:
On Thursday, 18 April 2013 at 13:37:45 UTC, ixid wrote:
I know this will not be changed, I just want to understand why it is as
it is.
My naive thought is that consistency is the best scheme and that
everything
I don't consider curent situation with static arrays as
incosistent.
When correctly understood is isn't as inconsistent, thank you for
explaining, this was the knowledge I was after.
Hi,
how i can control what writeln outputs when I pass an object
parameter?
Thanks,
Bogdan
On Thursday, 18 April 2013 at 17:36:10 UTC, gedaiu wrote:
Hi,
how i can control what writeln outputs when I pass an object
parameter?
Thanks,
Bogdan
You can override the toString() method, like this
http://dpaste.dzfl.pl/db7dbe28
On Thursday, 18 April 2013 at 17:42:53 UTC, JN wrote:
On Thursday, 18 April 2013 at 17:36:10 UTC, gedaiu wrote:
Hi,
how i can control what writeln outputs when I pass an object
parameter?
Thanks,
Bogdan
You can override the toString() method, like this
http://dpaste.dzfl.pl/db7dbe28
On 4/18/13, gedaiu szabobog...@yahoo.com wrote:
i've done that but i get this error:
Error: function base.Value.Value.toString cannot override a
non-virtual function
Error: function base.Value.Value.toString override only applies
to class member functions
If it's a struct then don't put
On Thursday, 18 April 2013 at 18:04:03 UTC, Andrej Mitrovic wrote:
On 4/18/13, gedaiu szabobog...@yahoo.com wrote:
i've done that but i get this error:
Error: function base.Value.Value.toString cannot override a
non-virtual function
Error: function base.Value.Value.toString override only
On Thursday, 18 April 2013 at 18:25:21 UTC, John Colvin wrote:
On Thursday, 18 April 2013 at 18:04:03 UTC, Andrej Mitrovic
wrote:
On 4/18/13, gedaiu szabobog...@yahoo.com wrote:
i've done that but i get this error:
Error: function base.Value.Value.toString cannot override a
non-virtual
Just drop the override:
struct Value {
string strVal;
this(string val) {
strVal = val;
}
override string toString() {
return strVal;
}
}
struct Value {
string strVal;
this(string val) {
strVal = val;
}
string
On Thursday, 18 April 2013 at 18:46:09 UTC, gedaiu wrote:
i have a struct not an object.
There's a slight nomenclature clash here:
Object is the base class in D. Therefore one could say that an
object is an instatiation of Object and therefore a class.
However, by a wider definition of the
On 04/18/2013 12:37 PM, John Colvin wrote:
However, by a wider definition of the word, a struct could also be said
to be an object.
You are missing some words there. :) Not a struct itself, but instances
of it are said to be objects.
Ali
Is this supposed to be allowed:
ubyte[] a;
ubyte[16] b;
a = b;
assert(a.ptr == b.ptr);
Because if so that makes it terribly easy to do a bug like this
(as I just saw in IRC):
struct A
{
ubyte[] a;
this(ubyte c)
{
ubyte[16] b;
b[] = c;
this.a = b; // a now
For reference, here was what user soos on IRC was doing that
caused him to hit this http://dpaste.dzfl.pl/08ee7b76#:
import std.digest.md;
import std.stdio;
struct Hash {
ubyte[] hash1;
ubyte[] hash2;
this (string str) {
auto md5 = new MD5Digest();
this.hash1 = md5.digest(str);
On Thursday, April 18, 2013 23:06:32 Brad Anderson wrote:
Is this supposed to be allowed:
ubyte[] a;
ubyte[16] b;
a = b;
assert(a.ptr == b.ptr);
Because if so that makes it terribly easy to do a bug like this
(as I just saw in IRC):
struct A
{
ubyte[] a;
this(ubyte c)
{
On 04/18/2013 02:06 PM, Brad Anderson wrote:
Is this supposed to be allowed:
ubyte[] a;
ubyte[16] b;
a = b;
assert(a.ptr == b.ptr);
Because if so that makes it terribly easy to do a bug like this (as I
just saw in IRC):
struct A
{
ubyte[] a;
this(ubyte c)
{
ubyte[16]
Brad Anderson:
Is this supposed to be allowed:
ubyte[] a;
ubyte[16] b;
a = b;
assert(a.ptr == b.ptr);
Yes, this is supposed to be allowed with the current design of D.
But with the latest dmd 2.063alpha that code doesn't work, see
below.
The Rust language removes this source of bugs
Jonathan M Davis:
I could see an argument that it should have to be
a = b[];
so that the slicing is explicit instead of just
a = b;
where it's implicit, but AFAIK, that's not currently required.
It's currently a warning, and it will be required.
--
Ali Çehreli:
On Thursday, 18 April 2013 at 21:45:56 UTC, bearophile wrote:
Yes, this is supposed to be allowed with the current design of
D. But with the latest dmd 2.063alpha that code doesn't work,
see below.
[snip]
Now that code gives a warning:
temp.d(11): Warning: explicit slice assignment
There is a similar problem with the automatically generated array
arguments.
The following constructor takes any number of ints that come in array
form:
import std.stdio;
struct S
{
int[] a;
this(int[] args...)
{
a = args;
}
void foo()
{
Steven Schveighoffer:
There is no guarantee that the incoming array from a variadic
function is heap-based.
But an interesting way to deal with it is that you can overload
with an explicit slice parameter, and the variadic version will
ONLY bind to a variadic call.
For example, in
On 04/18/2013 02:54 PM, Steven Schveighoffer wrote:
The program prints the following because the temporary arrays that are
generated when calling the constructors are long gone:
[1, 1, 1]
[1, 1, 1]
The programmer *may have* ;) expected the following output:
[1, 1, 1]
[2, 2, 2]
There
On Thu, Apr 18, 2013 at 02:43:54PM -0700, Ali Çehreli wrote:
On 04/18/2013 02:06 PM, Brad Anderson wrote:
Is this supposed to be allowed:
ubyte[] a;
ubyte[16] b;
a = b;
assert(a.ptr == b.ptr);
Because if so that makes it terribly easy to do a bug like this (as I
just saw in IRC):
Let's start over it has nothing to due with the file. It's the file name
thats the problem. I wote a short test program to demenstrate the problem.
It shows that if the file name has a path it causes the exception. i.e:
(prompt)dir
Volume in drive C is OS
Volume Serial Number is E221-AB60
Maybe there is a way to translate this Haskell version to D with
bigints:
http://rosettacode.org/wiki/Find_largest_left_truncatable_prime_in_a_given_base#Haskell
Unrelated: now I have a kind of efficient longest common
subsequence algorithm with O(n) memory usage. Maybe there is some
On 04/18/2013 04:25 PM, rbt...@digitalpath.net wrote:
Let's start over it has nothing to due with the file. It's the file name
thats the problem.
Let's start with the obvious. :)
Directory of c:\d\projects\equipment
std.exception.ErrnoException@std\stdio.d(289): Cannot open file
On 04/18/2013 06:22 AM, Joseph Rushton Wakeling wrote: On 04/17/2013
10:29 PM, Ali Çehreli wrote:
Yes but as I said I am not sure how useful or needed this whole
thing is.
The language handles copy, move, and assignment for structs.
takeOver() seems to
be a primitive operation for
34 matches
Mail list logo