Jeremy DeHaan:
I figured that it would be smart enough to
deduce the parameter type based on the type that it was trying
to be assigned to.
For that you need languages like Haskell/Rust. D type inference
doesn't work from the type something is assigned to.
Bye,
bearophile
On Friday, 30 January 2015 at 07:34:53 UTC, Mike Parker wrote:
On 1/30/2015 3:16 PM, Joel wrote:
Update.
What happens is, that I run the script file (in DAllegro
folder) and it
is suppose to create lib files from the DLL ones. On my
system, it says
its done it but no lib files pop up!
It h
On Friday, 30 January 2015 at 07:53:12 UTC, Kagamin wrote:
On Friday, 30 January 2015 at 06:16:21 UTC, Joel wrote:
What happens is, that I run the script file (in DAllegro
folder) and it is suppose to create lib files from the DLL
ones. On my system, it says its done it but no lib files pop
up
On 1/30/2015 6:48 PM, Joel wrote:
FYI, I have a nearly finished dynamic binding to Allegro 5 that
doesn't require any link-time dependencies. I'll be adding it to
DerelictOrg as soon as it's done. I hope that to be sometime on the
other side of this coming weekend. I only have a couple more addo
On Friday, 30 January 2015 at 08:52:41 UTC, bearophile wrote:
Jeremy DeHaan:
I figured that it would be smart enough to
deduce the parameter type based on the type that it was trying
to be assigned to.
For that you need languages like Haskell/Rust. D type inference
doesn't work from the typ
foreach(f; files))
{
if (canFind(to!string(f), " "))
{
writeln("whitespace found:");
writeln(f);
Thread.sleep( dur!("msecs")( 50 ) ); // sleep for 50
milliseconds
}
Error: module app struct std.regex.Thread(DataIndex) is private
Did you import core.thread?
On Thursday, 1 January 2015 at 22:49:40 UTC, Basile Burg wrote:
On Thursday, 1 January 2015 at 21:15:27 UTC, Ali Çehreli wrote:
On 01/01/2015 09:35 AM, Basile Burg wrote:
> On Tuesday, 30 December 2014 at 19:18:41 UTC, Basile Burg
wrote:
> an ICE (every
> compiler crash is an ICE right ?),
Ye
On 2015-01-30 at 11:55, FG wrote:
Error: module app struct std.regex.Thread(DataIndex) is private
Did you import core.thread?
This is silly. Thread is internal to std.regex, yet when importing both
std.regex and core.thread, you still get an error:
src.d(10): Error: core.thread.Thread a
On Wednesday, 24 December 2014 at 06:47:26 UTC, Joel wrote:
I can't get implib.exe (http://ftp.digitalmars.com/bup.zip) to
produce .lib files from dlls (https://www.allegro.cc/files/). I
think it works for other people.
Thanks for any help.
Yep, it works for other people. I've just made the
On Friday, January 30, 2015 10:39:44 Suliman via Digitalmars-d-learn wrote:
> foreach(f; files))
> {
> if (canFind(to!string(f), " "))
> {
> writeln("whitespace found:");
> writeln(f);
> Thread.sleep( dur!("msecs")( 50 ) );
On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:
Bug or correct behaviour?
Bug: https://issues.dlang.org/show_bug.cgi?id=1238
On 2015-01-30 at 12:08, Vladimir Panteleev wrote:
On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:
Bug or correct behaviour?
Bug: https://issues.dlang.org/show_bug.cgi?id=1238
https://github.com/D-Programming-Language/dmd/pull/3743
The fix is pretty much a one-liner.
Probably 2.067 wil
Hi.
The standard advice is not to worry about memory usage and
execution speed until profiling shows you where the problem is,
and I respect Knuth greatly as a thinker.
Still, one may learn from others' experience and cultivate good
habits early. To say that one should not prematurely optim
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote:
Hi.
The standard advice is not to worry about memory usage and
execution speed until profiling shows you where the problem is,
and I respect Knuth greatly as a thinker.
Still, one may learn from others' experience and cultivate
```
import std.container: RedBlackTree;
class Manager(TT, alias Cmp = "a
If I run the following example program from the 'Programming in
D' book, the input doesn't 'get stuck' as stated in the book but
instead produces the error message given. Have things changed
since that part of the book was written or is it some other
issue? The version that uses " %s" in the call
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote:
As I understand it, foreach allocates when a simple C-style for
using an array index would not.
foreach is just syntax sugar over a for loop. If there's any
allocations, it is because your code had some, it isn't inherit
to the
The real problem is if I comment my unittest out then it compiles. Why
my unittest causes this behaviour?
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
```
import std.container: RedBlackTree;
class Manager(TT, alias Cmp = "ait fails in a RedBlackTree unittest with 2.065 and 2.066, is it
bug?
Reduced:
import std.container: RedBlackTree;
alias Container = RedBlackTree!(int, "a
On Friday, 30 January 2015 at 13:11:35 UTC, anonymous wrote:
Lines 846-850:
static if(less == "a < b")
auto vals = [1, 2, 3, 4, 5];
else
auto vals = [5, 4, 3, 2, 1];
assert(equal(r, vals));
(Tab + Enter strikes again.)
That test looks wrong. So,
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
static init()
{
auto instance = new typeof(this)();
instance._cont = new Container();
return instance;
}
have you tried
---
static typeof(this) init()
{
auto instance = new typeof(th
On 30.01.2015 16:31, BBaz wrote:
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
static init()
{
auto instance = new typeof(this)();
instance._cont = new Container();
return instance;
}
have you tried
---
static typeof(this) init()
{
On 30.01.2015 16:14, anonymous wrote:
On Friday, 30 January 2015 at 13:11:35 UTC, anonymous wrote:
Lines 846-850:
static if(less == "a < b")
auto vals = [1, 2, 3, 4, 5];
else
auto vals = [5, 4, 3, 2, 1];
assert(equal(r, vals));
(Tab + Enter stri
On Friday, 30 January 2015 at 13:34:57 UTC, drug wrote:
On 30.01.2015 16:31, BBaz wrote:
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
static init()
{
auto instance = new typeof(this)();
instance._cont = new Container();
return instance;
}
have you tri
On 30.01.2015 16:35, drug wrote:
On 30.01.2015 16:14, anonymous wrote:
On Friday, 30 January 2015 at 13:11:35 UTC, anonymous wrote:
Lines 846-850:
static if(less == "a < b")
auto vals = [1, 2, 3, 4, 5];
else
auto vals = [5, 4, 3, 2, 1];
assert(eq
On Friday, 30 January 2015 at 13:39:05 UTC, BBaz wrote:
On Friday, 30 January 2015 at 13:34:57 UTC, drug wrote:
On 30.01.2015 16:31, BBaz wrote:
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
static init()
{
auto instance = new typeof(this)();
instance._cont = new Con
On Friday, 30 January 2015 at 13:56:17 UTC, anonymous wrote:
On Friday, 30 January 2015 at 13:39:05 UTC, BBaz wrote:
On Friday, 30 January 2015 at 13:34:57 UTC, drug wrote:
On 30.01.2015 16:31, BBaz wrote:
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
static init()
{
auto in
On 30.01.2015 17:04, BBaz wrote:
Yes, that was the point: "bad idea to call a member "init".
But I've missed something with inference of return type...
let's call this the "BMS" : big-mouth-syndrom...
I didn't know it could be ommitted...I thought it could be if the
function has the'@safe'attri
On 30.01.2015 16:56, anonymous wrote:
Besides, it's a bad idea to call a member "init", because it steals the
name of the default initializer. It doesn't override the default
initializer, it just takes its name. The compiler should not accept it,
in my opinion.
Good remark! I'll rename it.
On 1/30/15 5:06 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= "
wrote:
On Friday, 30 January 2015 at 08:52:41 UTC, bearophile wrote:
Jeremy DeHaan:
I figured that it would be smart enough to
deduce the parameter type based on the type that it was trying to be
assigned to.
For that you need languages li
On Friday, 30 January 2015 at 12:55:20 UTC, Adam D. Ruppe wrote:
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote:
As I understand it, foreach allocates when a simple C-style
for using an array index would not.
foreach is just syntax sugar over a for loop. If there's any
alloca
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote:
Hi.
The standard advice is not to worry about memory usage and
execution speed until profiling shows you where the problem is,
and I respect Knuth greatly as a thinker.
Still, one may learn from others' experience and cultivate
On 01/30/2015 04:49 AM, Paul wrote:
> If I run the following example program from the 'Programming in
> D' book, the input doesn't 'get stuck' as stated in the book but
> instead produces the error message given. Have things changed
> since that part of the book was written or is it some other
>
On Friday, 30 January 2015 at 00:09:17 UTC, Amber Thralll wrote:
And the errors dmd returns:
test.d(16): Error: class test.A!int.A is forward referenced
when looking for 'v'
test.d(16): Error: class test.A!int.A is forward referenced
when looking for 'opDot'
test.d(16): Error: class test.A!int.
On Friday, 30 January 2015 at 15:03:55 UTC, Ali Çehreli wrote:
Not the best error message... Saying '5' is unexpected for
'int' is confusing, right? Unfortunately, I can't come up with
a good explanation for that error message in the book. :)
Maybe just remove the section with the 'incorrect'
Given that myVals is a dynamic array of ints...
writeln("Array contents: ", myVals);
writeln("Sorted: ", sort(myVals));
writeln("Sorted, reversed: ", reverse(myVals));
Gives me...
Error: template std.stdio.writeln cannot deduce function from
argument types !()(string, void)
But, if I bring t
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
class Base
{
public void Foo(A a)
{
writeln("Base.Foo(A a)");
}
public void Foo(B a)
{
writeln("Base.Foo(B a)");
}
};
Compiler properly resolves forward references. Therefore, it's
definitely a compiler bug, and the template version should be
accepted.
On Friday, 30 January 2015 at 16:21:24 UTC, Kagamin wrote:
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
Or...
writeln("Reverse sorted: ", sort!("a > b")(vals));
but I still don't understand the original 'error'.
On Friday, 30 January 2015 at 17:07:17 UTC, Paul wrote:
On Friday, 30 January 2015 at 16:21:24 UTC, Kagamin wrote:
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
Or...
writeln("Reverse sorted: ", sort!("a > b")(vals));
but I still don't understand the original 'error'.
Take a look a
On 2015-01-30 at 17:07, Paul wrote:
writeln("Sorted, reversed: ", reverse(myVals));
Gives me...
Error: template std.stdio.writeln cannot deduce function from argument types
!()(string, void)
As it should, because reverse returns nothing, void.
But you may wonder what the design choice behind
On Friday, January 30, 2015 12:30:35 FG via Digitalmars-d-learn wrote:
> On 2015-01-30 at 12:08, Vladimir Panteleev wrote:
> > On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:
> >> Bug or correct behaviour?
> >
> > Bug: https://issues.dlang.org/show_bug.cgi?id=1238
>
> https://github.com/D-Pro
On 2015-01-30 at 18:42, FG wrote:
But you may wonder what the design choice behind that was that reverse doesn't
return the range itself while sort does (a SortedRange, specifically).
Although, after thinking about it, it makes sense. sort is used mostly to
enforce that something is sorted in
On Friday, January 30, 2015 18:42:57 FG via Digitalmars-d-learn wrote:
> On 2015-01-30 at 17:07, Paul wrote:
> > writeln("Sorted, reversed: ", reverse(myVals));
> >
> > Gives me...
> >
> > Error: template std.stdio.writeln cannot deduce function from argument
> > types !()(string, void)
>
> As it
On 01/30/2015 09:55 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> sort returns a different type rather than the original type, and that
type
> indicates that its sorted, and some algoritms are able to take
advantage of
> that.
I covered that a little bit during DConf 2014, at around 4
Hello everyone,
I am currently learning D by coding a project, but I encountered
a problem with one of my structures. I managed to reduce the code
to the minimum:
import std.stdio;
import std.container.rbtree;
struct Container {
private RedBlackTree!int _rbtree = new RedBlac
On Friday, 30 January 2015 at 18:46:55 UTC, Ali Çehreli wrote:
> there is no such benefit with reverse, so there's no need to
> return anything.
Still, returning the original range would help with chaining
calls:
arr.reverse.map!sqrt
Side note: There is the confusion between the .reverse p
On 1/30/15 12:49 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Friday, January 30, 2015 12:30:35 FG via Digitalmars-d-learn wrote:
On 2015-01-30 at 12:08, Vladimir Panteleev wrote:
On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:
Bug or correct behaviour?
Bug: https://issues.dl
This question is for people who have experience building the
website and/or documentation. It's not about the D language per
se. Here's a link to my work in progress:
https://github.com/zachthemystic/dlang.org/compare/starting
The advice here:
https://github.com/D-Programming-Language/dlang.o
module axfinance.api.currencies;
import std.array, std.stdio, std.system, std.bigint, std.conv;
class Currencies
{
public:
this(ulong pf)
{
exponent(pf);
}
bool integer(BigInt pb)
{
On 01/30/2015 11:59 AM, chardetm wrote:
> struct Container {
>
> private RedBlackTree!int _rbtree = new RedBlackTree!int;
I think you are expecting the new expression to be be executed for every
object individually. It is not the case: That new expression determines
the initial value of t
What do I need to learn?
On Friday, 30 January 2015 at 20:34:53 UTC, RuZzz wrote:
What do I need to learn?
c["BTC"]["N-01"] = 1.0002;//Error: cannot implicitly convert
expression (1) of type double to
axfinance.api.currencies.Currencies
As I see it, there is no constructor in your class with a double
argument.
Thanks a lot Ali, now it works perfectly!
It is quite hard to get used to D's logic, I have to stop
thinking in terms of C++...
Anyway, thanks again!
On Friday, January 30, 2015 10:46:54 Ali Çehreli via Digitalmars-d-learn wrote:
> On 01/30/2015 09:55 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > there is no such benefit with reverse, so there's no need to
> > return anything.
>
> Still, returning the original range would help with c
On 1/30/15 5:28 PM, Ali Çehreli wrote:
On 01/30/2015 11:59 AM, chardetm wrote:
> struct Container {
>
> private RedBlackTree!int _rbtree = new RedBlackTree!int;
I think you are expecting the new expression to be be executed for every
object individually. It is not the case: That new exp
On Friday, 30 January 2015 at 20:28:56 UTC, Zach the Mystic wrote:
This question is for people who have experience building the
website and/or documentation. It's not about the D language per
se. Here's a link to my work in progress:
https://github.com/zachthemystic/dlang.org/compare/starting
I'm attempting to print a human-readable version of a timestamp.
The timestamp is coming from an external service, via JSON. An
example is:
1421865781342
Which I know to be:
2015-01-21T18:43:01.342Z
The only method I see which takes an epoch-style timestamp, so
that I can convert it to some
On 31/01/2015 11:18 a.m., Chris Williams wrote:
I'm attempting to print a human-readable version of a timestamp. The
timestamp is coming from an external service, via JSON. An example is:
1421865781342
Which I know to be:
2015-01-21T18:43:01.342Z
The only method I see which takes an epoch-sty
On 01/30/2015 01:28 PM, Ary Borenszweig wrote:
> On 1/30/15 5:28 PM, Ali Çehreli wrote:
>> On 01/30/2015 11:59 AM, chardetm wrote:
>>
>> > struct Container {
>> >
>> > private RedBlackTree!int _rbtree = new RedBlackTree!int;
>>
>> I think you are expecting the new expression to be be exec
On Friday, 30 January 2015 at 22:22:27 UTC, Rikki Cattermole
wrote:
On a slightly related note, I have code for UTC+0 to unix time
stamp.
https://github.com/Devisualization/util/blob/b9ab5758e755c4e33832ac4aed0a5d7f2c728faf/source/core/devisualization/util/core/time.d
Unix timestamps can be ne
I am thinking about opening a bug with the following code:
struct S
{
@disable this();
static void opCall()
{}
}
void main()
{}
Error: struct deneme.S static opCall is hidden by constructors and can
never be called
Which seems to be due to the following change:
https://github.
On Fri, 30 Jan 2015 22:38:20 +, Chris Williams wrote:
> Unix timestamps can be negative
WUT?! O_O
signature.asc
Description: PGP signature
On Fri, 30 Jan 2015 15:26:11 -0500, Steven Schveighoffer wrote:
> D absolutely needs a way to say "this is ONLY for implementation, it's
> not part of the API." private fits this bill EXACTLY.
yep. every sane person recognizing D private symbols as "hidden". and
then... BOOM! The Hidden Gems Of
On 31/01/2015 12:06 p.m., ketmar wrote:
On Fri, 30 Jan 2015 22:38:20 +, Chris Williams wrote:
Unix timestamps can be negative
WUT?! O_O
Looks like we are both thinking the usual case.
The standard Unix time_t (data type representing a point in time) is a
signed integer data type, tradi
Hi,
I'm trying to use BitArray instead of rolling my own. But how
does one use it?
I tried:
import std.bitmanip : BitArray;
int main() {
BitArray b;
b[2] = true;
return 0;
}
$ gdc l.d
$ gdb a.out
(gdb) r
Program received signal SIGSEGV, Segmentation fault.
0x
On Friday, 30 January 2015 at 22:41:35 UTC, Ali Çehreli wrote:
I am thinking about opening a bug with the following code:
struct S
{
@disable this();
static void opCall()
{}
}
void main()
{}
Error: struct deneme.S static opCall is hidden by constructors
and can never be called
On Friday, 30 January 2015 at 22:38:21 UTC, Chris Williams wrote:
On Friday, 30 January 2015 at 22:22:27 UTC, Rikki Cattermole
wrote:
On a slightly related note, I have code for UTC+0 to unix time
stamp.
https://github.com/Devisualization/util/blob/b9ab5758e755c4e33832ac4aed0a5d7f2c728faf/sourc
On Sat, 31 Jan 2015 12:12:08 +1300, Rikki Cattermole wrote:
> On 31/01/2015 12:06 p.m., ketmar wrote:
>> On Fri, 30 Jan 2015 22:38:20 +, Chris Williams wrote:
>>
>>> Unix timestamps can be negative
>> WUT?! O_O
>
> Looks like we are both thinking the usual case.
>
> The standard Unix time_t
On Fri, 30 Jan 2015 23:42:04 +, Chris Williams wrote:
> On Friday, 30 January 2015 at 22:38:21 UTC, Chris Williams wrote:
>> On Friday, 30 January 2015 at 22:22:27 UTC, Rikki Cattermole wrote:
>>> On a slightly related note, I have code for UTC+0 to unix time stamp.
>>> https://github.com/Devi
On 01/30/2015 03:19 PM, BBaz wrote:
> It should only be an error when static opCall() cant be distinguishable
> from this.
>
> ---
> struct S
> {
> @disable this();
> static string opCall(){return "yo mister White";}
> }
> void main()
> {}
> ---
>
> is distinguishable (by return type) b
On Friday, 30 January 2015 at 23:50:53 UTC, ketmar wrote:
On Fri, 30 Jan 2015 23:42:04 +, Chris Williams wrote:
On Friday, 30 January 2015 at 22:38:21 UTC, Chris Williams
wrote:
On Friday, 30 January 2015 at 22:22:27 UTC, Rikki Cattermole
wrote:
On a slightly related note, I have code for
On 1/30/15 5:18 PM, Chris Williams wrote:
I'm attempting to print a human-readable version of a timestamp. The
timestamp is coming from an external service, via JSON. An example is:
1421865781342
Which I know to be:
2015-01-21T18:43:01.342Z
http://dlang.org/phobos/std_datetime.html#.unixTim
On Saturday, 31 January 2015 at 00:20:07 UTC, ketmar wrote:
On Sat, 31 Jan 2015 00:03:43 +, Chris Williams wrote:
since most database software probably
stores birthdates (many of which are pre-1970) in this format
O_O
a perfectly broken software.
And stdc:
http://h50146.www5.hp.com/prod
On Sat, 31 Jan 2015 00:03:43 +, Chris Williams wrote:
> since most database software probably
> stores birthdates (many of which are pre-1970) in this format
O_O
a perfectly broken software.
signature.asc
Description: PGP signature
"distinguish"
Yes, I know this a strange word. But it seems to be a valid one:
http://www.collinsdictionary.com/dictionary/english/distinguish?showCookiePolicy=true
"distinguishable" is ok as well.
On 01/30/2015 04:30 PM, BBaz wrote:
"distinguish"
Yes, I know this a strange word. But it seems to be a valid one:
http://www.collinsdictionary.com/dictionary/english/distinguish?showCookiePolicy=true
"distinguishable" is ok as well.
Sorry, I did not mean to emphasize "distinguish" over "d
On 1/30/15 7:29 PM, Ali Çehreli wrote:
On 01/30/2015 01:28 PM, Ary Borenszweig wrote:
> On 1/30/15 5:28 PM, Ali Çehreli wrote:
>> On 01/30/2015 11:59 AM, chardetm wrote:
>>
>> > struct Container {
>> >
>> > private RedBlackTree!int _rbtree = new RedBlackTree!int;
>>
>> I think yo
I think I have to set "length" first.
Yes.
Declaring
BitArray b;
is like declaring
int[] a; // ={.length = 0, . ptr = null}
you get the segfault for invalid dereference.
On Saturday, 31 January 2015 at 00:14:37 UTC, Steven
Schveighoffer wrote:
On 1/30/15 5:18 PM, Chris Williams wrote:
I'm attempting to print a human-readable version of a
timestamp. The
timestamp is coming from an external service, via JSON. An
example is:
1421865781342
Which I know to be:
2
On Friday, January 30, 2015 19:14:37 Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 1/30/15 5:18 PM, Chris Williams wrote:
> > I'm attempting to print a human-readable version of a timestamp. The
> > timestamp is coming from an external service, via JSON. An example is:
> >
> > 142186578
On Friday, January 30, 2015 22:03:02 Jonathan M Davis via Digitalmars-d-learn
wrote:
> Yeah. I really should add a unixTimeToSysTime function,
Actually, maybe it should be a static function on SysTime called
fromUnixTime to go with toUnixTime. I don't know. Regardless, it's a nicety
that should b
83 matches
Mail list logo