Re: simple dub question - avoiding creating a vibed project

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

On 5/01/2015 11:42 p.m., Laeeth Isharc wrote:

Figured out a fix:
  versions: [VibeCustomMain],

It is still mysterious as to why it is pulling in vibed though (I don't
import it, and I didn't think ddbc did).


https://github.com/mysql-d/mysql-native/blob/master/package.json


Re: simple dub question - avoiding creating a vibed project

2015-01-05 Thread Laeeth Isharc via Digitalmars-d-learn

On Monday, 5 January 2015 at 10:46:17 UTC, Rikki Cattermole wrote:

On 5/01/2015 11:42 p.m., Laeeth Isharc wrote:

Figured out a fix:
 versions: [VibeCustomMain],

It is still mysterious as to why it is pulling in vibed though 
(I don't

import it, and I didn't think ddbc did).


https://github.com/mysql-d/mysql-native/blob/master/package.json


aha.

isn't this a poor default for dub though?

ie if your parent project itself does not depend on vibed, the 
default should be that you take care of main yourself, and it 
does not try and use vibed's, no ?


Re: simple dub question - avoiding creating a vibed project

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

On 5/01/2015 11:55 p.m., Laeeth Isharc wrote:

On Monday, 5 January 2015 at 10:46:17 UTC, Rikki Cattermole wrote:

On 5/01/2015 11:42 p.m., Laeeth Isharc wrote:

Figured out a fix:
 versions: [VibeCustomMain],

It is still mysterious as to why it is pulling in vibed though (I don't
import it, and I didn't think ddbc did).


https://github.com/mysql-d/mysql-native/blob/master/package.json


aha.

isn't this a poor default for dub though?

ie if your parent project itself does not depend on vibed, the default
should be that you take care of main yourself, and it does not try and
use vibed's, no ?


https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/appmain.d#L28


simple dub question - avoiding creating a vibed project

2015-01-05 Thread Laeeth Isharc via Digitalmars-d-learn

Hi.

I am building an example for hibernated (I put a main around the 
sample code extract from the website).


How do I stop dub trying to build a vibed project?

Here is my dub.json

{
name: ddbc example,
description: example for DB Connector for D language, 
similar to JDBC,

authors: [Vadim Lopatin,Laeeth Isharc],
homepage: https://github.com/buggins/ddbc;,
license: Boost Software License (BSL 1.0),
dependencies: {
mysql-native: =0.0.12,
ddbc: =0.2.16,
},
targetType: executable,
libs-posix: [sqlite3, pq],
libs-windows: [sqlite3, libpq],
copyFiles-windows-x86: [ libs/win32/sqlite3.dll, 
libs/win32/libpq.dll, libs/win32/intl.dll ],
sourceFiles-windows-x86 : [ libs/win32/sqlite3.lib, 
libs/win32/libpq.lib ],

 targetPath: .,
}






Re: simple dub question - avoiding creating a vibed project

2015-01-05 Thread Laeeth Isharc via Digitalmars-d-learn

Figured out a fix:
 versions: [VibeCustomMain],

It is still mysterious as to why it is pulling in vibed though (I 
don't import it, and I didn't think ddbc did).


Compile for other OS's on Windows?

2015-01-05 Thread Bauss via Digitalmars-d-learn

Is it possible to compile for other OS's on Windows using dmd?


Re: Compile for other OS's on Windows?

2015-01-05 Thread Gary Willoughby via Digitalmars-d-learn

On Monday, 5 January 2015 at 11:49:32 UTC, Bauss wrote:

Is it possible to compile for other OS's on Windows using dmd?


This is what's known as cross compiling and is not currently 
supported by DMD at this time.


Re: simple dub question - avoiding creating a vibed project

2015-01-05 Thread Gary Willoughby via Digitalmars-d-learn

On Monday, 5 January 2015 at 10:27:06 UTC, Laeeth Isharc wrote:

Hi.

I am building an example for hibernated (I put a main around 
the sample code extract from the website).


How do I stop dub trying to build a vibed project?

Here is my dub.json

{
name: ddbc example,
description: example for DB Connector for D language, 
similar to JDBC,

authors: [Vadim Lopatin,Laeeth Isharc],
homepage: https://github.com/buggins/ddbc;,
license: Boost Software License (BSL 1.0),
dependencies: {
mysql-native: =0.0.12,
ddbc: =0.2.16,
},
targetType: executable,
libs-posix: [sqlite3, pq],
libs-windows: [sqlite3, libpq],
copyFiles-windows-x86: [ libs/win32/sqlite3.dll, 
libs/win32/libpq.dll, libs/win32/intl.dll ],
sourceFiles-windows-x86 : [ libs/win32/sqlite3.lib, 
libs/win32/libpq.lib ],

 targetPath: .,
}


I opened an issue about this last year:

https://github.com/mysql-d/mysql-native/issues/44


Re: What exactly shared means?

2015-01-05 Thread via Digitalmars-d-learn
On Saturday, 3 January 2015 at 23:11:08 UTC, Jonathan M Davis via 
Digitalmars-d-learn wrote:
Ideally, you would never cast away shared, and it would be cast 
away for you
by the compiler in sections of code where it can guarantee that 
it's safe to
do so (that was part of the idea behind synchronized classes). 
But that's
incredibly difficult to do, particularly in a useful way, so we 
don't
currently have it. And yes, that sucks, and we definitely want 
to fix it,
but I still think that it's far better than having everything 
be shared by

default like you get in languages like C++ and Java.


Efficient automatic synchronization is difficult, yes. You can 
try to tie groups of entities to a lock, but that will only work 
in some scenarios.


To me it sounds like having everything shared by default is the 
most conservative (safest) approach, and that it would make sense 
to put restrictions on parameters when you need more performance. 
If D's approach should make sense the compiler would allowed to 
elide atomics on members of an object the reference to the object 
is not marked as shared. That can easily go horribly wrong.


I am also not overly happy with D making TLS default. That means 
new threads instantiate a lot of unused memory if the workload is 
heterogeneous (different threads do different type of work). TLS 
only make sense for things that all threads need.


Re: simple dub question - avoiding creating a vibed project

2015-01-05 Thread Laeeth Isharc via Digitalmars-d-learn

I opened an issue about this last year:

https://github.com/mysql-d/mysql-native/issues/44


Thanks.


Laeeth.


Re: Compile for other OS's on Windows?

2015-01-05 Thread Bauss via Digitalmars-d-learn

On Monday, 5 January 2015 at 12:54:00 UTC, Gary Willoughby wrote:

On Monday, 5 January 2015 at 11:49:32 UTC, Bauss wrote:

Is it possible to compile for other OS's on Windows using dmd?


This is what's known as cross compiling and is not currently 
supported by DMD at this time.


Any alternatives?


Re: Compile for other OS's on Windows?

2015-01-05 Thread Joakim via Digitalmars-d-learn

On Monday, 5 January 2015 at 15:00:05 UTC, Bauss wrote:
On Monday, 5 January 2015 at 12:54:00 UTC, Gary Willoughby 
wrote:

On Monday, 5 January 2015 at 11:49:32 UTC, Bauss wrote:

Is it possible to compile for other OS's on Windows using dmd?


This is what's known as cross compiling and is not currently 
supported by DMD at this time.


Any alternatives?


You might be able to lightly tweak ldc to do it: I was able to 
cross-compile druntime/phobos, their unit tests, and some small 
sample apps on a linux/x86 host to run on a linux/ARM target.


The problem isn't really the D compiler so much as the other 
needed tools and environment.  Dmd and the other D compilers are 
automatically configured to use your system linker and link 
against the system's C standard library.  Well, optlink or the 
Microsoft linker on Windows don't know how to link for linux or 
OS X!


So you have to set up linkers and C libraries for every other OS 
you want to build for on Windows.  It's possible: the Android NDK 
can be installed on Windows with Cygwin and compile C/C++ code 
for the various Android architectures.  But none of the D 
compilers have gone to all the trouble to provide that 
cross-compiling support out of the box for all the various OSs 
they support.


It's easier to just run each OS in a VM on top of Windows, as 
Colin said.


Re: Template function type inference with default arguments

2015-01-05 Thread anonymous via Digitalmars-d-learn

On Sunday, 4 January 2015 at 00:22:01 UTC, ixid wrote:
Why don't templates take a type from the default argument if 
nothing else is supplied?


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


Conditional functions

2015-01-05 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
Is it possible to use static if in a template structure to have 
some member functions only for specific types?

E.g.:

struct Foo(T)
{
   ...

   T get() { ... }

   static if(isMutable!T)
   {
  void set(T x) { ... }
   }
}




Re: Conditional functions

2015-01-05 Thread Justin Whear via Digitalmars-d-learn
On Mon, 05 Jan 2015 17:47:09 +, Dominikus Dittes Scherkl wrote:

 Is it possible to use static if in a template structure to have some
 member functions only for specific types?

Yep.  This is actually a frequently used pattern in functions that return 
ranges.


Re: Conditional functions

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

On Monday, 5 January 2015 at 17:55:49 UTC, Justin Whear wrote:
On Mon, 05 Jan 2015 17:47:09 +, Dominikus Dittes Scherkl 
wrote:


Is it possible to use static if in a template structure to 
have some

member functions only for specific types?


Yep.  This is actually a frequently used pattern in functions 
that return

ranges.


Cool.
I'm every day again astonished how cool D really is.


Re: What exactly shared means?

2015-01-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 05, 2015 12:59:26 via Digitalmars-d-learn wrote:
 I am also not overly happy with D making TLS default. That means
 new threads instantiate a lot of unused memory if the workload is
 heterogeneous (different threads do different type of work). TLS
 only make sense for things that all threads need.

Well, if you don't like the choice of TLS by default, then you're going to
be unhappy with shared and its related issues regardless. Personally, I
think that having TLS be the default is a fantastic improvement over C++ and
that it results in much cleaner and safer code, especially since the vast
majority of code only lives on one thread anyway if you're dealing with
threads cleanly. But it's definitely true that what we're up to is an
experiment in how to handle TLS and shared storage, and by no means have we
gotten it perfect.

- Jonathan M Davis



Re: Conditional functions

2015-01-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 05, 2015 17:58:06 Dominikus Dittes Scherkl via 
Digitalmars-d-learn wrote:
 Cool.
 I'm every day again astonished how cool D really is.

And I'm increasingly frustrated with how other languages lack many of D's
cool features...

:)

- Jonathan M Davis



Re: Compile for other OS's on Windows?

2015-01-05 Thread Colin via Digitalmars-d-learn

On Monday, 5 January 2015 at 15:00:05 UTC, Bauss wrote:
On Monday, 5 January 2015 at 12:54:00 UTC, Gary Willoughby 
wrote:

On Monday, 5 January 2015 at 11:49:32 UTC, Bauss wrote:

Is it possible to compile for other OS's on Windows using dmd?


This is what's known as cross compiling and is not currently 
supported by DMD at this time.


Any alternatives?


Fire up a VM of the target machine (easy with any of the *nix 
systems) and compile on that?


Re: import std.random fails

2015-01-05 Thread ixid via Digitalmars-d-learn

On Friday, 31 August 2012 at 22:52:13 UTC, Jonathan M Davis wrote:

On Saturday, September 01, 2012 00:40:25 deed wrote:


import std.random

void main() {}
---

results in:

Error 42: Symbol Undefined
_D4core6memory2GC6qallocFkkZS4core6memory8BLkInfo_
Error 42: Symbol Undefined _D4core6memory2GC6extendFPvkkZk
Error 42: Symbol Undefined _D4core5bitop3bsrFNaNbkZi
--- errorlevel 3


What is wrong?


You druntime installation is bad due to some cruft left from a 
previous
install (the installer obviously needs some work). If you used 
an installer,
then uninstall dmd, make sure that it's completely removed, and 
then reinstall

it.

If you installed it manually, then make sure that you blow away 
druntime's
import directory and then restore it with the current version 
of those files.


- Jonathan M Davis


I am having this issue now. What else would I need to do other 
than uninstall and reinstall D on Windows to get it working? I 
tried that and it's not fixed it. Importing std.random in my own 
module which is in the project directory fails to find the symbol 
while importing std.algorithm works fine. Importing std.random in 
main.d works fine as well.


Error   1   Error 42: Symbol Undefined _D7objects12__ModuleInfoZ