Re: Moving forward with styling

2015-01-20 Thread Paolo Invernizzi via Digitalmars-d
On Tuesday, 20 January 2015 at 08:42:00 UTC, Paolo Invernizzi 
wrote:

On Monday, 19 January 2015 at 22:52:00 UTC, Andrei Alexandrescu


Andrei


I'm really going to hate the collapsing menu in the libraries: 
with that in place, and the one-entry-one-page, now I'm feeling 
very far away from the symbol target I want to reach...


---
Paolo


*ummm*

Nevermind, I just realized that I can use the body of the library 
main page: all the links are still there...


And it seems that the one-symbol-one-page is right now not 
operative; sorry, too many posts, it seems that I've missed 
something! ;-O


---
Paolo





Re: New menus are up

2015-01-20 Thread Jonas Drewsen via Digitalmars-d
On Tuesday, 20 January 2015 at 03:33:19 UTC, Andrei Alexandrescu 
wrote:

... aand we already have a contender!

https://github.com/D-Programming-Language/dlang.org/pull/790

Looks better than dlang.org?


Yeah definitely... better colors and spacing.


[Issue 13879] Default inizialization of function pointers array

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13879

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c15a50653e6a28215367908604ca9baffda68913
fix Issue 13879 - Default inizialization of function pointers array

https://github.com/D-Programming-Language/dmd/commit/ec380148a26884f4501341bc3c92f058a7aa0e8f
Merge pull request #4315 from 9rnsr/fix13879

Issue 13879 - Default inizialization of function pointers array

--


Re: ddoc template error

2015-01-20 Thread BlackEdder via Digitalmars-d-learn
Solved it. I had a _fromJSON comment somewhere else in the file 
and the underscore causes ddoc to fail


On Monday, 19 January 2015 at 20:47:42 UTC, BlackEdder wrote:
I'm trying to use ddoc to generate documentation, but get the 
following error:

$ dub -b docs
Building configuration library, build type docs
Running dmd...
source/painlessjson.d(287): Error: template 
painlessjson.fromJSON(T)(JSONValue json) unmatched --- in DDoc 
comment

FAIL . painlessjson staticLibrary
Error executing command run: dmd failed with exit code 1.

The relevant code:
/// Convert from JSONValue to any other type
T fromJSON(T)(JSONValue json)
{
 /* code */
}

The code on its own compiles normally (and passes all tests).

Link to full code:
https://github.com/BlackEdder/painlessjson/blob/master/source/painlessjson.d#L286

Any help appreciated :)




Re: [unittest] constness

2015-01-20 Thread Luc Bourhis via Digitalmars-d

On Monday, 19 January 2015 at 16:12:59 UTC, Luc Bourhis wrote:

Thanks everybody for your help!


Just one point I forgot to mention: the compiler chokes on

  static assert(!__traits(compiles, xc[0] = 1.0));

with:

found '=' when expecting ')' following template argument list

But

  static assert(!__traits(compiles, (xc[0] = 1.0)));

works.



[Issue 14014] struct init required for zero initialized static arrays

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14014

Martin Nowak c...@dawg.eu changed:

   What|Removed |Added

   Hardware|x86_64  |All
   Severity|enhancement |normal

--


[Issue 14014] New: struct init required for zero initialized static arrays

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14014

  Issue ID: 14014
   Summary: struct init required for zero initialized static
arrays
   Product: D
   Version: unspecified
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: c...@dawg.eu

cat  foo.di  CODE
struct Foo {}
CODE

cat  bug.d  CODE
import foo;

void main()
{
Foo[2] foo;
}
CODE

dmd bug

bug.o:bug.d:function _Dmain: error: undefined reference to '_D3foo3Foo6__initZ'


This is a problem for header only libraries (and some modules in druntime).

--


Re: Use proper frameworks for building dlang.org

2015-01-20 Thread via Digitalmars-d
An alternative is to create a good D wrapper for Zorba. I haven't 
tried Zorba myself, but it provides XQuery3/JSONiq support and is 
written to be embeddable (C++/C).


XQuery FLWOR expressions might work out ok combined with caching. 
FLWOR is supposedly easier for many programmers than XSLT and 
provides roughly the same expressive power. Both XQuery and XSLT 
are declarative languages and XPath based.


http://www.zorba.io/
http://www.jsoniq.org/

D badly needs to show support for XML infrastructure to be taken 
seriously.


Re: [RFC] Ini parser

2015-01-20 Thread Suliman via Digitalmars-d
It would be nice to add overload of getKey method so you can use 
something like this:

this.optionalkey = config.getKey(key1, defaultValue);

it's need for set default value if needed value can't be found on 
config.


rebind of const class variables

2015-01-20 Thread qqiang via Digitalmars-d-learn

I am writing a tree data structure, and I have the following code:

```D
final class Node {
private {
int val_;
Node parent_;
Node left_;
Node right_;
}

@property
const(Node) maximum() const {
auto ret = this;

while (ret.right_) {
ret = ret.right_;
}

return ret;
}
}
```

It failed to compile and complaint that `cannot modify const 
expression ret`。


Since `ret` is just a binding to a const class object, why can't 
I rebind it to another const class variable?


Must I use pointers to cope with this?

Thx


Re: Moving forward with styling

2015-01-20 Thread Paolo Invernizzi via Digitalmars-d
On Monday, 19 January 2015 at 22:52:00 UTC, Andrei Alexandrescu 
wrote:
I want us to get 
https://github.com/D-Programming-Language/dlang.org/pull/780 to 
a good state so it can be pulled and accept further 
improvements. I have difficulty integrating some of the 
drive-by advice here, so framing it as pull requests would make 
everyone's life simpler.


In spirit with the flatness of the new menu, I also removed the 
background image which was growing long in the tooth, leading 
to http://erdani.com/d/.


I've also added new menus for the libraries, both release 
http://erdani.com/d/phobos/index.html and prerelease 
http://erdani.com/d/phobos-prerelease/index.html


Is this ready to go and be subject to further improvements?


Thanks,

Andrei


I'm really going to hate the collapsing menu in the libraries: 
with that in place, and the one-entry-one-page, now I'm feeling 
very far away from the symbol target I want to reach...


---
Paolo


[Issue 14004] (╯▔︹▔)╯don't use this file https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js, can't access it in china

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14004

--- Comment #2 from Riki lp...@126.com ---
Oh
https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700
http://fonts.googleapis.com/css?family=Open+Sans:400,600,300
http://platform.twitter.com/widgets.js


(In reply to Orvid King from comment #1)
 Best solution to this would be to additionally host a copy of jQuery
 locally, and fall back to that copy if the original isn't loaded:
 
 scriptwindow.jQuery || document.write('script
 src=js/libs/jquery-1.7.2.min.js/script')/script

--


Re: ddoc template error

2015-01-20 Thread Mathias LANG via Digitalmars-d-learn

On Tuesday, 20 January 2015 at 08:55:58 UTC, BlackEdder wrote:
Solved it. I had a _fromJSON comment somewhere else in the file 
and the underscore causes ddoc to fail




If you could reduce it to a manageable size and post it to 
https://issues.dlang.org/ that'll be super cool :)


Re: rebind of const class variables

2015-01-20 Thread Mathias LANG via Digitalmars-d-learn

On Tuesday, 20 January 2015 at 09:29:46 UTC, qqiang wrote:
I am writing a tree data structure, and I have the following 
code:


```D
final class Node {
private {
int val_;
Node parent_;
Node left_;
Node right_;
}

@property
const(Node) maximum() const {
auto ret = this;

while (ret.right_) {
ret = ret.right_;
}

return ret;
}
}
```

It failed to compile and complaint that `cannot modify const 
expression ret`。


Since `ret` is just a binding to a const class object, why 
can't I rebind it to another const class variable?


Must I use pointers to cope with this?

Thx


You are looking for 
http://dlang.org/phobos/std_typecons.html#.Rebindable




Re: ddoc template error

2015-01-20 Thread BlackEdder via Digitalmars-d-learn

On Tuesday, 20 January 2015 at 09:38:55 UTC, Mathias LANG wrote:

On Tuesday, 20 January 2015 at 08:55:58 UTC, BlackEdder wrote:
Solved it. I had a _fromJSON comment somewhere else in the 
file and the underscore causes ddoc to fail




If you could reduce it to a manageable size and post it to 
https://issues.dlang.org/ that'll be super cool :)


Done:
https://issues.dlang.org/show_bug.cgi?id=14015


Re: DlangUI project update

2015-01-20 Thread Vadim Lopatin via Digitalmars-d-announce

On Friday, 26 December 2014 at 12:33:04 UTC, Vadim Lopatin wrote:

Hello!

DlangUI project is alive and under active development.

https://github.com/buggins/dlangui



Project update:

* A lot of bugs fixed
* Look and feel of default theme changed to one similar to Visual 
Studio 2013
* Project documentation is now generated by ddox: 
http://buggins.github.io/dlangui/ddox
* Updated screenshots 
http://buggins.github.io/dlangui/screenshots.html

* Font antialiasing and hinting settings
* New classes for toolbars, dockable UI
* Improvements in editors
* SourceEditor - supports line number display and syntax highlight

DlangIDE project is in progress.

https://github.com/buggins/dlangide

It's D IDE based on DlangUI.

Early alpha stage. Mainly useful as DlangUI demo, and for 
development of new functionality required for building of apps 
like IDE.


Can open sample workspace with two projects (dub.json only). Can 
browse projects and open source files in editor tabs.



First screenshot from 
http://buggins.github.io/dlangui/screenshots.html



Current activity: syntax highlight implementation
Next step: implement DUB based builder

Best regards,
 Vadim


Re: Number of Bits Needed to Represent a Zero-Offset Integer

2015-01-20 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn

On Monday, 19 January 2015 at 21:23:47 UTC, Nordlöw wrote:
On Monday, 19 January 2015 at 20:54:50 UTC, Steven 
Schveighoffer wrote:
Cool. I would point out that the commented code suggests you 
should be handling the 0 case, but you are not (when T.min == 
T.max)


I believe that should trigger a failing static assert with a 
good error message as it doesn't make any sense to call the 
function in that case. Thanks.


I would recommend to use something like this:

/// returns the number of the highest set bit +1 in the given 
value or 0 if no bit is set
size_t bitlen(T)(const(T) a) pure @safe @nogc nothrow 
if(isUnsigned!T)

{
   static if(T.sizeof = size_t.sizeof) // doesn't work for ulong 
on 32bit sys

   {
  return x ? core.bitop.bsr(x)+1 : 0;
   }
   else static if(T.sizeof == 8) // ulong if size_t == uint
   {
  return x ? x32 ? core.bitop.bsr(x)+33 : 
core.bitop.bsr(x)+1 : 0;

   }
}


[Issue 14015] New: ddoc Error: function unmatched as result of underscore in unittest comment

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14015

  Issue ID: 14015
   Summary: ddoc Error: function unmatched as result of underscore
in unittest comment
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: ed...@tkwsping.nl

Generating ddoc from the following code results in an error:

code:
///
void dummy()
{
}

/// Testing _name
unittest
{
assert( true );
} 

error:
$ dmd -main -D ddoc.d 
ddoc.d(2): Error: function ddoc.dummy unmatched --- in DDoc comment

The error goes away if you remove the underscore, or wrap it in quotes
(_name) and it seems to only occur in documentation comments before
unittests.

--


Re: Better README.md for dlang.org

2015-01-20 Thread Andrej Mitrovic via Digitalmars-d
On 1/20/15, Andrei Alexandrescu via Digitalmars-d
digitalmars-d@puremagic.com wrote:
 https://github.com/D-Programming-Language/dlang.org/blob/master/README.md

 1. If instructions don't work for you, reply here.

 2. Additions for Windows would be welcome. FWIW I think the Windows
 makefile suffers from a bit of bitrot.

Btw, apparently we can use a contributing file that automatically
shows up when people make pull requests:

https://help.github.com/articles/setting-guidelines-for-repository-contributors/


Re: Type safety and time units in Go and D

2015-01-20 Thread Paulo Pinto via Digitalmars-d

On Tuesday, 20 January 2015 at 10:44:54 UTC, Atila Neves wrote:
My buddy Jeff never learns... he sent me a blog post link about 
Go development today and I ended up comparing how the bug 
mentioned in the blog post wouldn't happen in D:


https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/

Atila


Just linked it on Reddit,

http://www.reddit.com/r/d_language/comments/2t1kaj/typesafety_and_time_intervals_in_d_and_go/


What is the Final?

2015-01-20 Thread RuZzz via Digitalmars-d-learn

Alexandrescu The_D_Programming_Language
page 264: 7.1.10 Subtyping with structs. The @disable Attribute
import std.stdio;
...
unittest {
auto a = Final!Widget(new Widget);
a.print(); // Fine, just print a
auto b = a; // Fine, a and b are bound to the same Widget
a = b; // Error!
// opAssign(Finai!Widget) is disabled!
a = new Widget; // Error!
// Cannot assign to rvatue returned by get()!
}

What is the Final in the code?


Re: Like Go/Rust, why not to have func keyword before function declaration

2015-01-20 Thread Kagamin via Digitalmars-d

On Monday, 19 January 2015 at 20:51:03 UTC, Alexey T. wrote:
Will be much easier to read Source, if func declarataion begins 
with keyword. def of func. e.g.


func myName(params.): typeOfResult;
or
func myName(params...) - typeOfResult;

easier to read and PARSE. Next D version may allow--with 
compatability of old syntad (C like where typeOfResult is 1st 
id).


Why reinvent pascal, but worse? Just go with it: 
http://freepascal.org/


[Issue 13860] template required forward reference for typeof(member)

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13860

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 13860] template required forward reference for typeof(member)

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13860

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3a5c42c44da72d4a2afbc6029e7b68da87946955
fix Issue 13860 - template required forward reference for typeof(member)

In a struct member function S.foo, 'this' is declared as a ref variable by
`declareThis()` in `FuncDeclaration::semantic3()`.
But in `VarDeclaration::semantic`, `type-hasPointer()` will needlessly try to
resolve struct fwdref.

All parameter variables won't be declared with void initializer, so the
reordering fixes the issue.

https://github.com/D-Programming-Language/dmd/commit/661f23ddde5d759fd5367f45f89803b79ab8e32c
Merge pull request #4316 from 9rnsr/fix13860

Issue 13860 - template required forward reference for typeof(member)

--


Type safety and time units in Go and D

2015-01-20 Thread Atila Neves via Digitalmars-d
My buddy Jeff never learns... he sent me a blog post link about 
Go development today and I ended up comparing how the bug 
mentioned in the blog post wouldn't happen in D:


https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/

Atila


Documenting the use of mixing templates

2015-01-20 Thread Luc Bourhis via Digitalmars-d
ddox does not seem to pick up on mixin 
MySuperDuperFeatures!(). So the only way at the moment seems 
to put a note in the class or the struct top documentation. Or am 
I missing something?


Re: mixin template and overloading

2015-01-20 Thread anonymous via Digitalmars-d

On Tuesday, 20 January 2015 at 11:30:39 UTC, Luc Bourhis wrote:

Consider:

~ % dmd -v|head -n 1
DMD64 D Compiler v2.066-devel

~% cat mixin_template_pb.d
mixin template Foo(T) {
  void bar() {}
}

struct FooBar {
  mixin Foo!int;
  void bar(ulong d)() {}
}

void check() {
  FooBar o;
  o.bar();
}
~% dmd -c mixin_template_pb.d
mixin_template_pb.d(12): Error: template 
mixin_template_pb.FooBar.bar cannot deduce function from 
argument types !()(), candidates are:
mixin_template_pb.d(7):
mixin_template_pb.FooBar.bar(ulong d)()


It looks like the compiler does not see the mixed-in bar. If 
I comment out the definition of bar in FooBar, it compiles 
fine. Is this to be considered a bug?


No, it's working as intended: If the name of a declaration in a 
mixin is the same as a declaration in the surrounding scope, the 
surrounding declaration overrides the mixin one -- 
http://dlang.org/template-mixin.html


You can use `alias` to bring the two together:

struct FooBar {
  mixin Foo!int f;
  alias bar = f.bar;
  void bar(ulong d)() {}
}


Re: Better README.md for dlang.org

2015-01-20 Thread Rikki Cattermole via Digitalmars-d

On 20/01/2015 11:19 p.m., Andrej Mitrovic via Digitalmars-d wrote:

On 1/20/15, Andrei Alexandrescu via Digitalmars-d
digitalmars-d@puremagic.com wrote:

https://github.com/D-Programming-Language/dlang.org/blob/master/README.md

1. If instructions don't work for you, reply here.

2. Additions for Windows would be welcome. FWIW I think the Windows
makefile suffers from a bit of bitrot.


Btw, apparently we can use a contributing file that automatically
shows up when people make pull requests:

https://help.github.com/articles/setting-guidelines-for-repository-contributors/


Ugh supposedly github supports a bunch of emoji and sounds:
http://www.emoji-cheat-sheet.com/

Well I learnt something today.


Re: rebind of const class variables

2015-01-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, January 20, 2015 09:29:45 qqiang via Digitalmars-d-learn wrote:
 I am writing a tree data structure, and I have the following code:

 ```D
 final class Node {
  private {
   int val_;
   Node parent_;
   Node left_;
   Node right_;
  }

  @property
  const(Node) maximum() const {
   auto ret = this;

   while (ret.right_) {
   ret = ret.right_;
   }

   return ret;
  }
 }
 ```

 It failed to compile and complaint that `cannot modify const
 expression ret`。

 Since `ret` is just a binding to a const class object, why can't
 I rebind it to another const class variable?

 Must I use pointers to cope with this?

No. You need to use http://dlang.org/phobos/std_typecons.html#.Rebindable

The thing to remember is that const is transitive, and when you have

const MyClass foo;

the reference itself is const, not just what it refers to. And the type
system doesn't have a way to represent a mutable reference to a const class
object, because it has no way of representing classes separately from
references to them. The two are, for better or worse, very much conflated as
far as the language is concerned. Pointers don't have that problem. e.g.

const(MyStruct)* foo;

but if you did

const(MyClass)* foo;

you'd just end up with a pointer to a const reference to a class object and
not a pointer to a const class object. Rebindable works around the problem
by being a mutable holder for the const reference to the class. It's a bit a
annoying and clunky, but it's a side effect of how there really isn't any
way in the language to represent class objects separately from the
references to them.

- Jonathan M Davis




Re: Better README.md for dlang.org

2015-01-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, January 19, 2015 15:14:16 Andrei Alexandrescu via Digitalmars-d 
wrote:
 https://github.com/D-Programming-Language/dlang.org/blob/master/README.md

 1. If instructions don't work for you, reply here.

 2. Additions for Windows would be welcome. FWIW I think the Windows
 makefile suffers from a bit of bitrot.

The windows makefile suffers from using an inferior version of make to
what's on the POSIX systems.

- Jonathan M Davis



Re: Better README.md for dlang.org

2015-01-20 Thread Mike via Digitalmars-d
On Tuesday, 20 January 2015 at 10:19:44 UTC, Andrej Mitrovic via 
Digitalmars-d wrote:


Btw, apparently we can use a contributing file that 
automatically

shows up when people make pull requests:

https://help.github.com/articles/setting-guidelines-for-repository-contributors/


That could be useful, but I don't think the build instructions 
should go there, because contributors won't even make it to the 
submitting a pull request if they can't build and verify their 
changes.  I think the build instructions should stay in the 
readme.  That's where I go to get started.


Mike


Re: What is the Final?

2015-01-20 Thread Rikki Cattermole via Digitalmars-d-learn

On 21/01/2015 12:58 a.m., RuZzz wrote:

Alexandrescu The_D_Programming_Language
page 264: 7.1.10 Subtyping with structs. The @disable Attribute
import std.stdio;
...
unittest {
auto a = Final!Widget(new Widget);
a.print(); // Fine, just print a
auto b = a; // Fine, a and b are bound to the same Widget
a = b; // Error!
// opAssign(Finai!Widget) is disabled!
a = new Widget; // Error!
// Cannot assign to rvatue returned by get()!
}

What is the Final in the code?


I'm guessing something along these lines:

struct Final(T) {
private T value;
alias value this;

this(T value) {
this.value = value;
}

@disable
void opAssign(T)(T t) {}
}


Re: Undefined reference error when array size is given

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d-learn

On 1/19/15 4:49 PM, Steven Schveighoffer wrote:


I figured it out, poll.d is missing from here:

https://github.com/D-Programming-Language/druntime/blob/master/mak/SRCS

So it's for some reason not purposely included.

I think there's an expectation (I'm probably guilty of this too) that if
you include a file somewhere in druntime's core subdirectory, it gets
compiled in.

There are actually quite a few files not included... not sure why.


And the answer:
http://forum.dlang.org/thread/1fe961b1-8454-4298-ad8f-16069971e...@yahoo.com#post-54BE1AF6.7040805:40dawg.eu

https://issues.dlang.org/show_bug.cgi?id=14014

So it looks like it's a DMD bug and we should not include that module.

-Steve


Re: What is the Final?

2015-01-20 Thread bearophile via Digitalmars-d-learn

Rikki Cattermole:


I'm guessing something along these lines:


A Phobos patch:
https://github.com/D-Programming-Language/phobos/pull/2881

Bye,
bearophile


Re: This Week in D, issue 2

2015-01-20 Thread via Digitalmars-d-announce
Nice, maybe you should consider using a more descriptive link on 
reddit for the next issue?


Basically providing keywords highlighting the content. E.g. This 
Week in D: loading DLLs, XBox controller, Dconf 2015 details...


[Issue 13297] [CTFE] Modifications of user type pointer member passed by ref in function disappear

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13297

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
(In reply to Denis Shelomovskij from comment #0)
 This code should compile fine:
 ---
 struct S
 {
 int* p;
 }
 
 void f(ref int* p)
 {
 p = cast(int*) 1;
 assert(p); // passes
 }
 
 void main()
 {
 static assert(
 {
 S s;
 f(s.p);
 return s.p == null; // false

You meant:
  return s.p != null; // false
?

 } ());
 }
 ---

--


Re: New menus are up

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/19/15 10:29 PM, Andrei Alexandrescu wrote:

Take a look at http://dlang.org. New menus are in place for the main
site and library.

I think we're in a better place than before. However, there are a few
things left to do. I'd very much appreciate help with those.

* New docs don't yet have the new menu implemented.

* Menu tracking works, i.e. if the URL a page matches a menu entry, then
the menu will automatically open to that page and mark the entry active.
However, that's rather simplistic; for example navigating
http://dlang.org/statement.html does not open the Documentation menu
because the link is not directly present.

A simple and probably desirable fix would be to just make Language
Reference a top-level menu entry with submenus. Could one of our
awesome lieutenants see to it?

* Better colors etc. are always welcome. Please submit your pull
requests with screenshots so we can appreciate.


Looks excellent!

3 issues:

1. when browsing the library, the rest of the menu disappears (i.e. the 
rest of the menu is gone). You can click on the D Lib 2.066.1 menu at 
the top to get back, but it's not obvious. There should at least be a 
back or home button in that menu.
2. Some of the library expansions don't fit into the column (e.g. 
std.windows.charset).
3. When I expand one section, the existing expanded section collapses. I 
hate this. First, if I want all of them open, I can't do that (this may 
be important on the library navigation). Second, if you have a large 
expanded section open, and you expand a smaller section that is below 
it, it sucks the menu back up above the screen, making you have to 
scroll up. For example, try opening std, then open core. To open core, 
you have to scroll way down. As soon as you open it, the menu gets 
sucked away.


I know your response will be awaiting your PR :) I'll try and see if I 
can fix at least the expansion problem.


The menu is a huge HUGE improvement, the old one was too subtle.

-Steve


mixin template and overloading

2015-01-20 Thread Luc Bourhis via Digitalmars-d

Consider:

~ % dmd -v|head -n 1
DMD64 D Compiler v2.066-devel

~% cat mixin_template_pb.d
mixin template Foo(T) {
  void bar() {}
}

struct FooBar {
  mixin Foo!int;
  void bar(ulong d)() {}
}

void check() {
  FooBar o;
  o.bar();
}
~% dmd -c mixin_template_pb.d
mixin_template_pb.d(12): Error: template 
mixin_template_pb.FooBar.bar cannot deduce function from argument 
types !()(), candidates are:
mixin_template_pb.d(7):mixin_template_pb.FooBar.bar(ulong 
d)()


It looks like the compiler does not see the mixed-in bar. If I 
comment out the definition of bar in FooBar, it compiles 
fine. Is this to be considered a bug?


Re: Type safety and time units in Go and D

2015-01-20 Thread via Digitalmars-d

On Tuesday, 20 January 2015 at 10:44:54 UTC, Atila Neves wrote:
My buddy Jeff never learns... he sent me a blog post link about 
Go development today and I ended up comparing how the bug 
mentioned in the blog post wouldn't happen in D:


https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/


FWIW this is type safe in a duck-typing language like Python too:

from datetime import timedelta

t = timedelta(10)
assert( t + t == timedelta(20) )
t*t

TypeError: unsupported operand type(s) for *: 
'datetime.timedelta' and 'datetime.timedelta'


Problem with coupling shared object symbol visibility with protection

2015-01-20 Thread Benjamin Thaut via Digitalmars-d
I'm currently working on Windows DLL support which has stronger rules 
than linux shared objects for which symbols actually get exported from a 
shared library. But as we want to replicate the same behaviour on linux 
using symbol visibility (e.g. gcc 4 -fVisibility=hidden) this issue also 
applies to linux once implemented.


Currently export means two things:
- the symbol is publicy accessible (same as public)
- the symbol will be accisble across shared library boundaries


This has the following issue:

export void templateFunc(T)()
{
  someHelperFunc();
}

private void someHelperFunc()
{

}

And you don't even have to go into phobos to hit this problem. It is 
already in druntime see core.time.FracSec._enforceValid


This works with the current linux shared objects because they simply 
export all symbols. But once only symbols with export get exported this 
breaks.


The problem here is that you don't want to make someHelperFunc() export 
because that would mean users could call it directly, but you want it to 
be available for cross shared library calls. The cross shared library 
call happens if a template is instanced from a different shared library 
/ executable than the module it was originally located in.


There are two solutions for this.

1) Given that export is transitive (that means if a struct or class is 
declared export every member that is _not_ private will be accessible 
across shared library boundaries. This behaviour is required to make the 
export protection level work on windows)


You can now do the following:

export struct SomeStruct
{
  static public void templateFunc(T)()
  {
someHelperFunc();
  }

  static package void someHelperFunc()
  {

  }
}

Because of the transitivity someHelperFunc will be exported but still 
not be callable by the user directly. This can be used to fix the issue 
in core.time but may not be so well suited if you want the template to 
be on module level instead of nesting it into a struct.


2) Make export an attribute. If export is no longer an protection level 
but instead an attribute this issue can easily be solved by doing.


export public void templateFunc(T)()
{
  someHelperFunc();
}

export private void someHelperFunc()
{

}

But this would require grammar changes. Which are generally avoided if 
possible.


There would be a third option, which I rather avoid. Doing a 
pramga(forceExport) or something like that.


My implementation, which I ran into this issue with, currently usses 
approach 1. What do you think how this sould be solved?


Walter: What was the general idea behind export when you designed it, 
and how can it be used to solve this problem?


Kind Regards
Benjamin Thaut


Re: What is the Final?

2015-01-20 Thread Kagamin via Digitalmars-d-learn
Probably borrowed from java: 
http://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.12.4


[Issue 13297] [CTFE] Modifications of user type pointer member passed by ref in function disappear

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13297

--- Comment #2 from Denis Shelomovskij verylonglogin@gmail.com ---
(In reply to Kenji Hara from comment #1)
 
 You meant:
   return s.p != null; // false
 ?

Yes, sorry.

--


Re: ...test my shiny new nntp clinet...

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/20/15 8:54 AM, ketmar via Digitalmars-d wrote:

Hello.

is there any officially dead newsgroups on dlang.org that nobody
sees, yet they still working and can be used to test my simple nntp
code?

yes, i know that i can setup local nntp server and play with it, but i
want to test it on dlang groups to see if it's really working, and i
can't up local dfeed, sorry.

so is there some forgotten group which aren't used anymore, and server
owners don't mind if someone spam it with various test messages? i've
seen alot groups in nntp list, can i...



http://forum.dlang.org/group/D

Vladimir already uses it for testing.

-Steve


Re: Like Go/Rust, why not to have func keyword before function declaration

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/19/15 8:35 PM, Ary Borenszweig wrote:

On 1/19/15 9:17 PM, Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:

So... how do you search for a function definition in D without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an IDE. It
never occurred to me that this was not doable :-)


But the results will also contain invocations of that function. Do you
go one by one until you find the definition?


Yep. Do it all the time. It's not that hard to see the difference 
between a definition and usage.


-Steve


Re: New menus are up

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/20/15 7:36 AM, Steven Schveighoffer wrote:


I know your response will be awaiting your PR :) I'll try and see if I
can fix at least the expansion problem.


https://github.com/D-Programming-Language/dlang.org/pull/800

-Steve


Re: Undefined reference error when array size is given

2015-01-20 Thread ketmar via Digitalmars-d-learn
On Tue, 20 Jan 2015 07:00:31 -0500
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:

 On 1/19/15 4:49 PM, Steven Schveighoffer wrote:
 
  I figured it out, poll.d is missing from here:
 
  https://github.com/D-Programming-Language/druntime/blob/master/mak/SRCS
 
  So it's for some reason not purposely included.
 
  I think there's an expectation (I'm probably guilty of this too) that if
  you include a file somewhere in druntime's core subdirectory, it gets
  compiled in.
 
  There are actually quite a few files not included... not sure why.
 
 And the answer:
 http://forum.dlang.org/thread/1fe961b1-8454-4298-ad8f-16069971e...@yahoo.com#post-54BE1AF6.7040805:40dawg.eu
oh, i see, i wasn't thought about moduleinfo and other data.

 https://issues.dlang.org/show_bug.cgi?id=14014
 
 So it looks like it's a DMD bug and we should not include that module.
sorry, i can't see how this bug is related to non-inclusion. actually,
it's about the exact opposite!

p.s. it it even necessary to generate moduleinfo for modules without
initializers and without complex data structures with references?


signature.asc
Description: PGP signature


Re: Like Go/Rust, why not to have func keyword before function declaration

2015-01-20 Thread MattCoder via Digitalmars-d
On Tuesday, 20 January 2015 at 13:47:11 UTC, ketmar via 
Digitalmars-d wrote:

  void function foo () { ... }
  foo();

do you see the subtle difference? yes, that tiny whitespace in
declaration. i borrowed that habit from some Oberon code 
decades ago, and it serves me well since then.


Hmm, nice one. I think I'll do this too.

Matheus.



Re: rebind of const class variables

2015-01-20 Thread ketmar via Digitalmars-d-learn
On Tue, 20 Jan 2015 09:29:45 +
qqiang via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:

 I am writing a tree data structure, and I have the following code:
 
 ```D
 final class Node {
  private {
   int val_;
   Node parent_;
   Node left_;
   Node right_;
  }
 
  @property
  const(Node) maximum() const {
   auto ret = this;
   
   while (ret.right_) {
   ret = ret.right_;
   }
   
   return ret;
  }
 }
 ```
 
 It failed to compile and complaint that `cannot modify const 
 expression ret`。
 
 Since `ret` is just a binding to a const class object, why can't 
 I rebind it to another const class variable?
 
 Must I use pointers to cope with this?
Jonathan explains it very well. i can add the only thing: don't use
`const` until you forced to. ;-) C++ programmers tend to help
compiler with const methods and so on. just don't do that in D until
you become friends with D constness.

sure, you can cast `const` away in your code, but using `cast` is a
good sign of taking the wrong way.


signature.asc
Description: PGP signature


Re: Undefined reference error when array size is given

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d-learn

On 1/20/15 9:07 AM, ketmar via Digitalmars-d-learn wrote:

On Tue, 20 Jan 2015 07:00:31 -0500
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:



https://issues.dlang.org/show_bug.cgi?id=14014

So it looks like it's a DMD bug and we should not include that module.

sorry, i can't see how this bug is related to non-inclusion. actually,
it's about the exact opposite!


The point is, it generates moduleinfo needlessly.


p.s. it it even necessary to generate moduleinfo for modules without
initializers and without complex data structures with references?


A good point. It certainly would make this less of an issue.

-Steve



Re: ...test my shiny new nntp clinet...

2015-01-20 Thread ketmar via Digitalmars-d
On Tue, 20 Jan 2015 09:22:52 -0500
Steven Schveighoffer via Digitalmars-d digitalmars-d@puremagic.com
wrote:

 On 1/20/15 8:54 AM, ketmar via Digitalmars-d wrote:
  Hello.
 
  is there any officially dead newsgroups on dlang.org that nobody
  sees, yet they still working and can be used to test my simple nntp
  code?
 
  yes, i know that i can setup local nntp server and play with it, but i
  want to test it on dlang groups to see if it's really working, and i
  can't up local dfeed, sorry.
 
  so is there some forgotten group which aren't used anymore, and server
  owners don't mind if someone spam it with various test messages? i've
  seen alot groups in nntp list, can i...
 
 
 http://forum.dlang.org/group/D
 
 Vladimir already uses it for testing.
aha, i see. thank you very much.


signature.asc
Description: PGP signature


Re: New menus are up

2015-01-20 Thread via Digitalmars-d
They are a usability disaster. Try click on std then on etc. 
The menu disappears due to std being long.


Re: rebind of const class variables

2015-01-20 Thread bearophile via Digitalmars-d-learn

ketmar:

Jonathan explains it very well. i can add the only thing: don't 
use `const` until you forced to. ;-)


In D use immutable (or const) everywhere you can. Possibly mark 
as immutable everything doesn't need to mutate.



sure, you can cast `const` away in your code, but using `cast` 
is a good sign of taking the wrong way.


Casting away a const is quite dangerous in D because if you later 
mutate the data, you will probably have bugs.


Bye,
bearophile


Re: Like Go/Rust, why not to have func keyword before function declaration

2015-01-20 Thread ketmar via Digitalmars-d
On Mon, 19 Jan 2015 22:35:16 -0300
Ary Borenszweig via Digitalmars-d digitalmars-d@puremagic.com wrote:

 On 1/19/15 9:17 PM, Walter Bright wrote:
  On 1/19/2015 2:49 PM, Ary Borenszweig wrote:
  So... how do you search for a function definition in D without an IDE?
 
  I do a text search for the name of the function.
 
  I've been programming in C, C++, and D for 30 years without an IDE. It
  never occurred to me that this was not doable :-)
 
 But the results will also contain invocations of that function. Do you 
 go one by one until you find the definition?
heh.

  void function foo () { ... }
  foo();

do you see the subtle difference? yes, that tiny whitespace in
declaration. i borrowed that habit from some Oberon code decades ago,
and it serves me well since then.


signature.asc
Description: PGP signature


Re: Like Go/Rust, why not to have func keyword before function declaration

2015-01-20 Thread ketmar via Digitalmars-d
On Tue, 20 Jan 2015 13:49:47 +
MattCoder via Digitalmars-d digitalmars-d@puremagic.com wrote:

 On Tuesday, 20 January 2015 at 13:47:11 UTC, ketmar via 
 Digitalmars-d wrote:
void function foo () { ... }
foo();
 
  do you see the subtle difference? yes, that tiny whitespace in
  declaration. i borrowed that habit from some Oberon code 
  decades ago, and it serves me well since then.
 
 Hmm, nice one. I think I'll do this too.
be my guest. ;-) i'll be glad if it will help you.

the only bad thing i found with this style is that after some time you
really start noticing the absense of whitespace in declaraions, and it
annoys you. so the first thing you want to do with someone's code is to
ADD THAT WHITESPACES! somehow it becomes most frustrating element of
alien code styling. ;-)


signature.asc
Description: PGP signature


Re: Type safety and time units in Go and D

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/20/15 5:44 AM, Atila Neves wrote:

My buddy Jeff never learns... he sent me a blog post link about Go
development today and I ended up comparing how the bug mentioned in the
blog post wouldn't happen in D:

https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/


On the question of why that is the way it is, it's because we actually 
thought of all that shit when designing the time library :) I was a big 
proponent of not using the same type to mean duration and timestamp, and 
only allowing sane operations. Jonathan was the same way.


You can see some if it here:

http://forum.dlang.org/thread/340452.74950...@web58008.mail.re3.yahoo.com
http://forum.dlang.org/thread/201008141800.31122.jmdavisp...@gmail.com
http://forum.dlang.org/thread/201010081404.59147.jmdavisp...@gmx.com


Ah, the nostalgia :)

-Steve



Re: New menus are up

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/19/15 10:29 PM, Andrei Alexandrescu wrote:

* New docs don't yet have the new menu implemented.


Also forums.

-Steve


...test my shiny new nntp clinet...

2015-01-20 Thread ketmar via Digitalmars-d
Hello.

is there any officially dead newsgroups on dlang.org that nobody
sees, yet they still working and can be used to test my simple nntp
code?

yes, i know that i can setup local nntp server and play with it, but i
want to test it on dlang groups to see if it's really working, and i
can't up local dfeed, sorry.

so is there some forgotten group which aren't used anymore, and server
owners don't mind if someone spam it with various test messages? i've
seen alot groups in nntp list, can i...


signature.asc
Description: PGP signature


Re: Type safety and time units in Go and D

2015-01-20 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, January 20, 2015 08:24:34 Steven Schveighoffer via Digitalmars-d 
wrote:
 On 1/20/15 5:44 AM, Atila Neves wrote:
  My buddy Jeff never learns... he sent me a blog post link about Go
  development today and I ended up comparing how the bug mentioned in the
  blog post wouldn't happen in D:
 
  https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/

 On the question of why that is the way it is, it's because we actually
 thought of all that shit when designing the time library :) I was a big
 proponent of not using the same type to mean duration and timestamp, and
 only allowing sane operations. Jonathan was the same way.

That separation is one of the main reasons for introducing MonoTime
recently as a replacement for TickDuration, because TickDuration conflates
the monotonic timestamp and monotonic duration. With MonoTime, we end up
with a separate monotonic timestamp and then use the same duration type that
we've been using everywhere else (Duration), which then also has the benefit
of reducing the number of duration types (which has caused far too much
confusion). But TickDuration was a minimally changed version of SHOO's Ticks
type, and I did a very poor job of integrating it into core.time and
std.datetime when std.datetime was introduced. It's never really fit with
the rest.

- Jonathan M Davis



[Issue 14014] struct init required for zero initialized static arrays

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14014

Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #1 from Steven Schveighoffer schvei...@yahoo.com ---
In addition to this, we should probably not generate ModuleInfo when it's not
needed.

The reason this came about is because a module that is basically import-only
was not included in druntime. But you could not compile code that used the
included struct.

The rationale of avoiding including it in druntime build was to avoid adding
unnecessary ModuleInfo bloat. It would be nice if you could include it and the
bloat wasn't added if the compiler detected it didn't need it.

--


Re: New menus are up

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d
On 1/20/15 9:25 AM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= 
ola.fosheim.grostad+dl...@gmail.com wrote:

They are a usability disaster. Try click on std then on etc. The
menu disappears due to std being long.


Heh, just wrote about that.

https://github.com/D-Programming-Language/dlang.org/pull/800

-Steve


Re: rebind of const class variables

2015-01-20 Thread ketmar via Digitalmars-d-learn
On Tue, 20 Jan 2015 14:45:26 +
bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:

 ketmar:
 
  Jonathan explains it very well. i can add the only thing: don't 
  use `const` until you forced to. ;-)
 
 In D use immutable (or const) everywhere you can. Possibly mark 
 as immutable everything doesn't need to mutate.
i didn't tell a word about `immutable`. ;-)

but `const` transitiveness confusing newcomers alot. eventually they
will catch it and then they will see how my advice is not applicable to
'em anymore. but until then i believe that they better don't use
`const` at all instead of becoming constantly frustrated with it's
non-friendly behavior.


signature.asc
Description: PGP signature


Re: New menus are up

2015-01-20 Thread bearophile via Digitalmars-d

Vladimir Panteleev:


All expandable sections should show up as expanded when no JS is
available.


But currently they aren't doing that, right?

Bye,
bearophile


[Issue 7874] [CTFE] internal error: unsupported assignment (x OP= y) = z

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7874

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #6 from Kenji Hara k.hara...@gmail.com ---
Fixed in 2.067a git-head, by:
https://github.com/D-Programming-Language/dmd/pull/4227

Test case addition:
https://github.com/D-Programming-Language/dmd/pull/4319

--


Re: New menus are up

2015-01-20 Thread Andrei Alexandrescu via Digitalmars-d

On 1/20/15 5:25 AM, Steven Schveighoffer wrote:

On 1/20/15 7:36 AM, Steven Schveighoffer wrote:


I know your response will be awaiting your PR :) I'll try and see if I
can fix at least the expansion problem.


https://github.com/D-Programming-Language/dlang.org/pull/800


I figured if I wanted to go to core when std is open I wouldn't 
scroll down to find it; I'd just first close the longer menu then expand 
the shorter one.


But no matter. Let's see how this goes. I've merged 800 and pushed the 
new site. Thanks, and all please let us know how it works!



Andrei



Re: New menus are up

2015-01-20 Thread Andrei Alexandrescu via Digitalmars-d

On 1/20/15 8:33 AM, Vladimir Panteleev wrote:

On Tuesday, 20 January 2015 at 16:31:12 UTC, bearophile wrote:

Vladimir Panteleev:


All expandable sections should show up as expanded when no JS is
available.


But currently they aren't doing that, right?


They are. It is working for me when I disable JS in Firefox (via
about:config).

If it doesn't work for you, how can I reproduce the problem?


There was a bug for a while that hid everything. Might be a matter of 
refreshing. -- Andrei


Re: New menus are up

2015-01-20 Thread Kiith-Sa via Digitalmars-d
On Tuesday, 20 January 2015 at 16:33:43 UTC, Vladimir Panteleev 
wrote:

On Tuesday, 20 January 2015 at 16:31:12 UTC, bearophile wrote:

Vladimir Panteleev:

All expandable sections should show up as expanded when no JS 
is

available.


But currently they aren't doing that, right?


They are. It is working for me when I disable JS in Firefox 
(via about:config).


If it doesn't work for you, how can I reproduce the problem?


It's broken with NoScript if dlang.org is allowed but 
ajax.googleapis.com is disallowed.


[Issue 1625] CTFE: cannot evaluate function when return type includes a union

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1625

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
From about 2.055, the code works properly in CTFE.

--


Re: New menus are up

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/20/15 11:43 AM, Andrei Alexandrescu wrote:

On 1/20/15 5:25 AM, Steven Schveighoffer wrote:

On 1/20/15 7:36 AM, Steven Schveighoffer wrote:


I know your response will be awaiting your PR :) I'll try and see if I
can fix at least the expansion problem.


https://github.com/D-Programming-Language/dlang.org/pull/800


I figured if I wanted to go to core when std is open I wouldn't
scroll down to find it; I'd just first close the longer menu then expand
the shorter one.


The use case is probably more like you are down on the std.datetime page 
reading some function signature, then realize that what you really need 
is core.time, so you scroll up until you see the core expander, and 
click on it.


Just as a user experience general observation, I should not be able to 
click on something to see what's inside, and have it run away from 
sight, even if that's not the right way to do it.


In any case, I see the changes and appreciate the result! Thanks.

-Steve


[Issue 7492] [CTFE] Error at assign to immutable character array

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7492

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Kenji Hara k.hara...@gmail.com ---
(In reply to Denis Shelomovskij from comment #0)
 ---
 auto f() { return new char[1];  }
 
 immutable s = f(); // error, works with non-character arrays
 ---
 Error: cannot implicitly convert expression (\xff) of type char[] to
 immutable(char[])

The function returns char[]. In D type system, char[] to immutable(char[])
conversion is not allowed.

If you annotate the function f with pure attribute, f() will return an unique
array so compiler will allow the conversion.

Anyway, this is not CTFE problem. The code is trying to violate D type system,
and compiler reports the error correctly.

--


Re: Type safety and time units in Go and D

2015-01-20 Thread Laeeth Isharc via Digitalmars-d

 the question of why that is the way it is, it's because we

actually
thought of all that shit when designing the time library :) I 
was a big
proponent of not using the same type to mean duration and 
timestamp, and

only allowing sane operations. Jonathan was the same way.


That separation is one of the main reasons for introducing


I would like to express my appreciation to the implementors  (I 
guess Jonathan and Stephen) as well as to the Phobos guardians 
for taking the pains to implement the datetime library in a 
thoughtful and conscious way.


Dates are not conventionally the most glamorous part of a 
library, but they are very important in some key use cases for D. 
 Much of finance is about net present value, and for that you 
need to get datetimes right.  Every swap has a bunch of 
cashflows, and you need to apply various market conventions in 
generating these.  Eg cashflows are every three months, and you 
roll forward if the payment day is a holiday, unless that would 
take you to the next month, in which case you roll backwards.  
Similarly for analyzing high frequency data, one needs to be able 
to work easily with timestamps.


I was so frustrated by numpy's datetime64 that I ended up rolling 
my own, so it is encouraging that my new chosen platform (D) 
natively does a much better job.


The level of attention to detail, high standards, and 
appreciation of beauty are some of the best things about the 
language and the people here.


On a different note, and having read the discussion Jonathan 
linked to: bounded int, and better messages about template 
constraints would certainly be things I would find helpful.




Re: Better README.md for dlang.org

2015-01-20 Thread H. S. Teoh via Digitalmars-d
On Tue, Jan 20, 2015 at 08:40:04AM -0800, Andrei Alexandrescu via Digitalmars-d 
wrote:
 On 1/20/15 8:32 AM, H. S. Teoh via Digitalmars-d wrote:
 On Tue, Jan 20, 2015 at 08:24:29AM -0800, Andrei Alexandrescu via 
 Digitalmars-d wrote:
 On 1/20/15 2:19 AM, Andrej Mitrovic via Digitalmars-d wrote:
 On 1/20/15, Andrei Alexandrescu via Digitalmars-d
 digitalmars-d@puremagic.com wrote:
 https://github.com/D-Programming-Language/dlang.org/blob/master/README.md
 
 1. If instructions don't work for you, reply here.
 
 2. Additions for Windows would be welcome. FWIW I think the
 Windows makefile suffers from a bit of bitrot.
 
 Btw, apparently we can use a contributing file that automatically
 shows up when people make pull requests:
 
 https://help.github.com/articles/setting-guidelines-for-repository-contributors/
 
 Shall we move README.md to CONTRIBUTING.md then? -- Andrei
 
 We should have both. The current README.md should explain what the
 repo is all about. Details on contributing should go in
 CONTRIBUTING.md.
 
 Yah, you're right. By the time someone has made a pull request,
 they're already hooked in :o). Could you please draft a brief
 CONTRIBUTING.md? -- Andrei

Looks like README.md already has info about contributing?

https://github.com/D-Programming-Language/dlang.org/pull/803


T

-- 
Let X be the set not defined by this sentence...


Re: Type safety and time units in Go and D

2015-01-20 Thread Atila Neves via Digitalmars-d

I went to post it but someone else already did:

http://www.reddit.com/r/programming/comments/2t25nx/typesafety_and_time_intervals_in_d_and_go_xpost/


Atila

On Tuesday, 20 January 2015 at 16:26:01 UTC, Andrei Alexandrescu 
wrote:

On 1/20/15 3:56 AM, Paulo Pinto wrote:

On Tuesday, 20 January 2015 at 10:44:54 UTC, Atila Neves wrote:
My buddy Jeff never learns... he sent me a blog post link 
about Go
development today and I ended up comparing how the bug 
mentioned in

the blog post wouldn't happen in D:

https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/


Atila


Just linked it on Reddit,

http://www.reddit.com/r/d_language/comments/2t1kaj/typesafety_and_time_intervals_in_d_and_go/


Better post in /r/programming. -- Andrei




Re: New menus are up

2015-01-20 Thread Vladimir Panteleev via Digitalmars-d

On Tuesday, 20 January 2015 at 07:21:31 UTC, Phil wrote:
Pull 790 would be a big improvement . The current page also 
doesn't seem to be working properly. The right margin is empty 
except for a link to the D Twitter feed at the very top. I 
assume there's supposed to be a widget there showing tweets 
like before (although I never liked that).


Perhaps an ad blocker or something similar is preventing it from 
showing up in your browser?


See if it works in a different browser.


Re: Type safety and time units in Go and D

2015-01-20 Thread Andrei Alexandrescu via Digitalmars-d

On 1/20/15 3:56 AM, Paulo Pinto wrote:

On Tuesday, 20 January 2015 at 10:44:54 UTC, Atila Neves wrote:

My buddy Jeff never learns... he sent me a blog post link about Go
development today and I ended up comparing how the bug mentioned in
the blog post wouldn't happen in D:

https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/


Atila


Just linked it on Reddit,

http://www.reddit.com/r/d_language/comments/2t1kaj/typesafety_and_time_intervals_in_d_and_go/


Better post in /r/programming. -- Andrei



Re: New menus are up

2015-01-20 Thread Vladimir Panteleev via Digitalmars-d
On Tuesday, 20 January 2015 at 13:44:09 UTC, Steven Schveighoffer 
wrote:

On 1/19/15 10:29 PM, Andrei Alexandrescu wrote:

* New docs don't yet have the new menu implemented.


Also forums.


I'll get to that once the design stabilizes.


DMD backend/el.c is missing vector declarations

2015-01-20 Thread Etienne via Digitalmars-d
The el_match function on lines 2393-2615 of backend/el.c doesn't 
elaborate cases for simd. I'm not going to make a pull request because I 
don't have time to work through the lengthy process of isolating a 
particular bug, so, here they are for anyone that needs to tweak their 
own dmd:


case TYfloat4:
case TYdouble2:
case TYschar16:
case TYuchar16:
case TYshort8:
case TYushort8:
case TYlong4:
case TYulong4:
case TYllong2:
case TYullong2:
		if(n1-EV.Vcent.msw != n2-EV.Vcent.msw || n1-EV.Vcent.lsw != 
n2-EV.Vcent.lsw)

goto nomatch;
break;


Re: New menus are up

2015-01-20 Thread Vladimir Panteleev via Digitalmars-d

On Tuesday, 20 January 2015 at 15:41:30 UTC, bearophile wrote:

Andrei Alexandrescu:


I think we're in a better place than before.


If the browser detects no JavaScript it can present a simpler 
alternative but usable menu.


All expandable sections should show up as expanded when no JS is
available.


Re: New menus are up

2015-01-20 Thread bearophile via Digitalmars-d

Vladimir Panteleev:


If it doesn't work for you, how can I reproduce the problem?


Today browsers are terribly complex, there's little hope to 
reproduce an environment. So never mind, ignore my precedent 
comment...


Bye,
bearophile


How's the new allocator module going and where to get it?

2015-01-20 Thread Elvis Zhou via Digitalmars-d

I can't find it in official repos.


Re: Type safety and time units in Go and D

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/20/15 10:34 AM, Atila Neves wrote:

The question about how it is the way it is was about why the Go library
allows things like that since the Go team apparently does believe in
type safety.


Yes, I misread I showed him the code and he seemed really interested in 
it, and also wondered which design decisions led to the current state of 
affairs. as the state of affairs in D. :)


-Steve


[Issue 13739] in CTFE making an array over an array copies the data

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13739

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords|wrong-code  |pull
   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4320

--


Re: New menus are up

2015-01-20 Thread bearophile via Digitalmars-d

Andrei Alexandrescu:


I think we're in a better place than before.


If the browser detects no JavaScript it can present a simpler 
alternative but usable menu.


Bye,
bearophile


Re: New menus are up

2015-01-20 Thread Vladimir Panteleev via Digitalmars-d

On Tuesday, 20 January 2015 at 16:31:12 UTC, bearophile wrote:

Vladimir Panteleev:

All expandable sections should show up as expanded when no JS 
is

available.


But currently they aren't doing that, right?


They are. It is working for me when I disable JS in Firefox (via 
about:config).


If it doesn't work for you, how can I reproduce the problem?


[Issue 13297] [CTFE] Modifications of user type pointer member passed by ref in function disappear

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13297

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Kenji Hara k.hara...@gmail.com ---
(In reply to Denis Shelomovskij from comment #2)
 (In reply to Kenji Hara from comment #1)
  
  You meant:
return s.p != null; // false
  ?
 
 Yes, sorry.

OK, the CTFE issue is recently fixed by my CTFE engine cleanup.
https://github.com/D-Programming-Language/dmd/pull/4227

To avoid regression, will add a test case.
https://github.com/D-Programming-Language/dmd/pull/4319

--


Re: Type safety and time units in Go and D

2015-01-20 Thread Atila Neves via Digitalmars-d
The question about how it is the way it is was about why the Go 
library allows things like that since the Go team apparently does 
believe in type safety. Nevertheless, thanks for the links!


Atila

On Tuesday, 20 January 2015 at 13:24:34 UTC, Steven Schveighoffer 
wrote:

On 1/20/15 5:44 AM, Atila Neves wrote:
My buddy Jeff never learns... he sent me a blog post link 
about Go
development today and I ended up comparing how the bug 
mentioned in the

blog post wouldn't happen in D:

https://atilanevesoncode.wordpress.com/2015/01/20/type-safety-and-time-intervals-in-d-and-go/


On the question of why that is the way it is, it's because we 
actually thought of all that shit when designing the time 
library :) I was a big proponent of not using the same type to 
mean duration and timestamp, and only allowing sane operations. 
Jonathan was the same way.


You can see some if it here:

http://forum.dlang.org/thread/340452.74950...@web58008.mail.re3.yahoo.com
http://forum.dlang.org/thread/201008141800.31122.jmdavisp...@gmail.com
http://forum.dlang.org/thread/201010081404.59147.jmdavisp...@gmx.com


Ah, the nostalgia :)

-Steve




Re: New menus are up

2015-01-20 Thread Vladimir Panteleev via Digitalmars-d
On Tuesday, 20 January 2015 at 03:36:16 UTC, Andrei Alexandrescu 
wrote:

On 1/19/15 7:34 PM, Vladimir Panteleev wrote:
On Tuesday, 20 January 2015 at 03:32:38 UTC, Rikki Cattermole 
wrote:
Say ugh, when was the last time somebody clicked the ol' 
Page wiki

buttons.
Because atleast for intro, it doesn't exist.


They don't need to all exist. The idea is to link to a page 
that anyone
can create, and then anyone else can get to by clicking the 
same link in

the page header.


I fear that newcomers finding many of those page unpopulated 
would think there's no activity etc. -- Andrei


I could run a script to populate them with a placeholder.

These pages were numerous on the old wiki, and although we could 
look into migrating them, most information is likely outdated by 
now.


Re: Better README.md for dlang.org

2015-01-20 Thread H. S. Teoh via Digitalmars-d
On Tue, Jan 20, 2015 at 08:24:29AM -0800, Andrei Alexandrescu via Digitalmars-d 
wrote:
 On 1/20/15 2:19 AM, Andrej Mitrovic via Digitalmars-d wrote:
 On 1/20/15, Andrei Alexandrescu via Digitalmars-d
 digitalmars-d@puremagic.com wrote:
 https://github.com/D-Programming-Language/dlang.org/blob/master/README.md
 
 1. If instructions don't work for you, reply here.
 
 2. Additions for Windows would be welcome. FWIW I think the Windows
 makefile suffers from a bit of bitrot.
 
 Btw, apparently we can use a contributing file that automatically
 shows up when people make pull requests:
 
 https://help.github.com/articles/setting-guidelines-for-repository-contributors/
 
 Shall we move README.md to CONTRIBUTING.md then? -- Andrei

We should have both. The current README.md should explain what the repo
is all about. Details on contributing should go in CONTRIBUTING.md.


T

-- 
It is the quality rather than the quantity that matters. -- Lucius Annaeus 
Seneca


Re: Better README.md for dlang.org

2015-01-20 Thread Andrei Alexandrescu via Digitalmars-d

On 1/20/15 8:32 AM, H. S. Teoh via Digitalmars-d wrote:

On Tue, Jan 20, 2015 at 08:24:29AM -0800, Andrei Alexandrescu via Digitalmars-d 
wrote:

On 1/20/15 2:19 AM, Andrej Mitrovic via Digitalmars-d wrote:

On 1/20/15, Andrei Alexandrescu via Digitalmars-d
digitalmars-d@puremagic.com wrote:

https://github.com/D-Programming-Language/dlang.org/blob/master/README.md

1. If instructions don't work for you, reply here.

2. Additions for Windows would be welcome. FWIW I think the Windows
makefile suffers from a bit of bitrot.


Btw, apparently we can use a contributing file that automatically
shows up when people make pull requests:

https://help.github.com/articles/setting-guidelines-for-repository-contributors/


Shall we move README.md to CONTRIBUTING.md then? -- Andrei


We should have both. The current README.md should explain what the repo
is all about. Details on contributing should go in CONTRIBUTING.md.


Yah, you're right. By the time someone has made a pull request, they're 
already hooked in :o). Could you please draft a brief CONTRIBUTING.md? 
-- Andrei




Re: How's the new allocator module going and where to get it?

2015-01-20 Thread Vladimir Panteleev via Digitalmars-d

On Tuesday, 20 January 2015 at 15:56:12 UTC, Elvis Zhou wrote:

I can't find it in official repos.


I believe the development is on Andrei's Phobos fork, branch 
allocator:


https://github.com/andralex/phobos/blob/allocator/std/allocator.d

Documentation (not sure how up-to-date it is, though):

http://erdani.com/d/phobos-prerelease/std_allocator.html


Re: New menus are up

2015-01-20 Thread Andrei Alexandrescu via Digitalmars-d

On 1/20/15 7:41 AM, bearophile wrote:

Andrei Alexandrescu:


I think we're in a better place than before.


If the browser detects no JavaScript it can present a simpler
alternative but usable menu.


Yah, it leaves all submenus open. -- Andrei




Re: forcing @nogc on class destructors

2015-01-20 Thread Meta via Digitalmars-d
On Tuesday, 20 January 2015 at 18:12:27 UTC, ketmar via 
Digitalmars-d wrote:

Hello.

as there is no possibility to doing GC allocations in class
destructors, wouldn't it be nice to just force @nogc 
attribute on

such dtors?

i know, i know, this will break alot of code. i'm pretty sure 
that

this will break alot of INVALID code, which better be broken at
compile-time anyway.

sure, we have alot of code of pre-@nogc era, and alot of code 
where
authord didn't bother to add attributes at all. so we can 
introduce
--force-dtor-nogc CLI arg and document this change, making it 
opt-in

for, say, six month and opt-out after that.

and i know that D devs (Walter at least) are resistant to 
command-line
flags that changing compiler behavior. i don't know how to 
overcome
this. say, by adding @gc attribute, which dfix can 
automatically add?


but i still believe that instead of telling people again and 
again that
they should not allocate in class destructors, we can use 
computer

itself to track and stop this behavior.

let's see how this proposal will be rejected. will there be 
some sane
reasons, or only the good old song about broken code? make 
your bets!


Isn't this just an implementation detail of the current garbage 
collector? If so, then we shouldn't tie language semantics to it, 
as it could change.


[Issue 7492] [CTFE] Error at assign to immutable character array

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7492

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
(In reply to Denis Shelomovskij from comment #3)
 If function is executed during CTFE it's definitely effectively `pure` for
 given parameters so I don't understand your arguments.

Again, CTFE is not relevant. The OP code just fails to pass semantic analysis.
CTFE never runs on invalid code.

 Anyway works with non-character arrays comment isn't addressed. Event if
 this compiler error is an expected behaviour, the issue is in the fact other
 types don't produce the same error (try e.g. `int` and `Object` arrays).

Is that diagnostic issue? Please file another report. Thanks!

--


Re: Like Go/Rust, why not to have func keyword before function declaration

2015-01-20 Thread Joakim via Digitalmars-d

On Tuesday, 20 January 2015 at 00:13:37 UTC, Brian Schott wrote:
On Monday, 19 January 2015 at 22:49:41 UTC, Ary Borenszweig 
wrote:
So... how do you search for a function definition in D without 
an IDE?


Running `dscanner --help` prints this:

--declaration | -d symbolName [sourceFiles sourceDirectories]
Find the location where symbolName is declared. This should 
be more
accurate than grep. Searches the given files and 
directories, or the

current working directory if none are specified.


^
THIS!

I agree with Ary that grep hits a lot of false positives and all 
the formatting tricks don't work with other people's code, plus 
I've never liked IDES.  Dscanner's D declaration finder has 
become indispensable in the short time I've been using it, to the 
point where I dread going back to searching for C declarations 
and getting stuck with grep again.


[Issue 14017] New: Assignment of a mutable array returned from non-`pure` function to `immutable` global variable is allowed

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14017

  Issue ID: 14017
   Summary: Assignment of a mutable array returned from non-`pure`
function to `immutable` global variable is allowed
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: accepts-invalid
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: verylonglogin@gmail.com

This code compiles but shouldn't:
---
auto f() { return new int[1];  }

immutable s = f(); // error only with character arrays
---

Also such code is currently rejected for arrays of characters.

--


[Issue 7492] [CTFE] Error at assign to immutable character array

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7492

Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |INVALID

--- Comment #5 from Denis Shelomovskij verylonglogin@gmail.com ---
(In reply to Kenji Hara from comment #4)
 (In reply to Denis Shelomovskij from comment #3)
  Anyway works with non-character arrays comment isn't addressed. Event if
  this compiler error is an expected behaviour, the issue is in the fact other
  types don't produce the same error (try e.g. `int` and `Object` arrays).
 
 Is that diagnostic issue? Please file another report. Thanks!

Filed issue 14017.

--


Re: forcing @nogc on class destructors

2015-01-20 Thread ketmar via Digitalmars-d
On Tue, 20 Jan 2015 18:17:56 +
Meta via Digitalmars-d digitalmars-d@puremagic.com wrote:

 On Tuesday, 20 January 2015 at 18:12:27 UTC, ketmar via 
 Digitalmars-d wrote:
  Hello.
 
  as there is no possibility to doing GC allocations in class
  destructors, wouldn't it be nice to just force @nogc 
  attribute on
  such dtors?
 
  i know, i know, this will break alot of code. i'm pretty sure 
  that
  this will break alot of INVALID code, which better be broken at
  compile-time anyway.
 
  sure, we have alot of code of pre-@nogc era, and alot of code 
  where
  authord didn't bother to add attributes at all. so we can 
  introduce
  --force-dtor-nogc CLI arg and document this change, making it 
  opt-in
  for, say, six month and opt-out after that.
 
  and i know that D devs (Walter at least) are resistant to 
  command-line
  flags that changing compiler behavior. i don't know how to 
  overcome
  this. say, by adding @gc attribute, which dfix can 
  automatically add?
 
  but i still believe that instead of telling people again and 
  again that
  they should not allocate in class destructors, we can use 
  computer
  itself to track and stop this behavior.
 
  let's see how this proposal will be rejected. will there be 
  some sane
  reasons, or only the good old song about broken code? make 
  your bets!
 
 Isn't this just an implementation detail of the current garbage 
 collector? If so, then we shouldn't tie language semantics to it, 
 as it could change.
how likely this to be changed? is there *any* chances of that in 2015?
2016? and why we can't just remove that restriction when new GC will be
implemented? removing the @nogc requirement on class dtors will break
*nothing* *at* *all*. yet adding it now, while we don't have that new
GC, will prevent alot of bugs that can slip in crack.

btw, you won the prize of not talking about broken code! sadly, i
forgot to setup the prizes... anyway, thanks for sane argument.


signature.asc
Description: PGP signature


[Issue 14017] Assignment of a mutable array returned from non-`pure` function to `immutable` global variable is allowed

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14017

Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #1 from Steven Schveighoffer schvei...@yahoo.com ---
It's CTFE executed, so immutable is fine. Although I think it would be
permissible for pure to be inferred here because of the auto return type.

The bug is the opposite -- it should allow the char[] array to also be
assigned.

--


[Issue 13295] [CTFE] Modifications of const user type disappear

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13295

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4319

--


Re: Better README.md for dlang.org

2015-01-20 Thread Andrei Alexandrescu via Digitalmars-d

On 1/20/15 2:19 AM, Andrej Mitrovic via Digitalmars-d wrote:

On 1/20/15, Andrei Alexandrescu via Digitalmars-d
digitalmars-d@puremagic.com wrote:

https://github.com/D-Programming-Language/dlang.org/blob/master/README.md

1. If instructions don't work for you, reply here.

2. Additions for Windows would be welcome. FWIW I think the Windows
makefile suffers from a bit of bitrot.


Btw, apparently we can use a contributing file that automatically
shows up when people make pull requests:

https://help.github.com/articles/setting-guidelines-for-repository-contributors/


Shall we move README.md to CONTRIBUTING.md then? -- Andrei



[Issue 7492] [CTFE] Error at assign to immutable character array

2015-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7492

Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |---

--- Comment #3 from Denis Shelomovskij verylonglogin@gmail.com ---
(In reply to Kenji Hara from comment #2)
 (In reply to Denis Shelomovskij from comment #0)
  ---
  auto f() { return new char[1];  }
  
  immutable s = f(); // error, works with non-character arrays
  ---
  Error: cannot implicitly convert expression (\xff) of type char[] to
  immutable(char[])
 
 The function returns char[]. In D type system, char[] to immutable(char[])
 conversion is not allowed.
 
 If you annotate the function f with pure attribute, f() will return an
 unique array so compiler will allow the conversion.
 
 Anyway, this is not CTFE problem. The code is trying to violate D type
 system, and compiler reports the error correctly.

If function is executed during CTFE it's definitely effectively `pure` for
given parameters so I don't understand your arguments.

Anyway works with non-character arrays comment isn't addressed. Event if this
compiler error is an expected behaviour, the issue is in the fact other types
don't produce the same error (try e.g. `int` and `Object` arrays).

--


  1   2   3   >