Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread rmc via Digitalmars-d-learn
On Thursday, 13 September 2018 at 14:31:53 UTC, Jesse Phillips 
wrote:

On Monday, 10 September 2018 at 09:23:19 UTC, SuperPrower wrote:
dub was working nice until I updated my system (I run 
ArchLinux32) just now. dmd was updated from version 
1:2.081.2-1.0 to 1:2.082.0-1.0 (according to pacman package 
manager). After that, I couldn't invoke dub for anything. Here 
is the attempt to run `dub --vverbose`:


Can you find /usr/bin/dmd or run dmd?


The error is from the trymain function in dmd so its definitely 
installed.


I do wonder if `dmd` by itself on the command line works. Could 
it be some sort of 32 bit bug in the latest release of dmd? 
Relating to argc/argv.


Re: remove file access denied

2018-09-13 Thread Norm via Digitalmars-d-learn
On Thursday, 13 September 2018 at 23:25:24 UTC, Josphe Brigmo 
wrote:

I am trying to remove a file

remove(filename);

and I get an access denied!

I can remove it from explorer just fine.

I am able to remove other files but there should be no reason 
why the file can't be removed in this case.


All I am doing to mess with the file is reading it's contents 
right before to do a file compare(I am removing the file if it 
is a duplicate).


Does read() lock the file at all? (maybe the lock is persisting 
just long enough to make the remove fail?


Since I can delete the file outside the program and since the 
filename is valid(I copied and pasted it to remove it to 
check), This seems like a D problem.


Do you have the file open when you call remove? If so close the 
file handle before the remove call. If you can post a stripped 
down version of your code it would also help.


bye,
Norm


Re: DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-13 Thread dangbinghoo via Digitalmars-d-learn

On Wednesday, 12 September 2018 at 15:13:36 UTC, Timoses wrote:


try `dub --build-mode=singleFile` ? I believe this will compile 
each file and then link them together (instead of compiling it 
all together what dub does, afaik).
There's been another topic on memory consumption of compilation 
[1].


[1]: 
https://forum.dlang.org/post/ehyfilopozdndjdah...@forum.dlang.org


thanks timoses ,

singleFile mode works for building, but when linking, I got this:

--
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown Option : LLIB
OPTLINK : Warning 9: Unknown Option : WIN32
C:\Users\Administrator.USER-20180912OL\AppData\Local\dub\packages\gtk-d-3.8.3\gtk-d\.dub\build\library-debug-windows-x86-dmd_2082-9C5C1D99F672708E9D6D6FE9E60296B4\gtkd-3.lib
 Warning 178: .LIB pagesize exceeds 512
C:\Users\Administrator.USER-20180912OL\AppData\Local\dub\packages\gtk-d-3.8.3\gtk-d\.dub\build\library-debug-windows-x86-dmd_2082-9C5C1D99F672708E9D6D6FE9E60296B4\gtkd-3.lib
 Error 7: Out of Memory
Error: linker exited with status 1
dmd failed with exit code 1.
---

I think that DMD should give up it's DMC linkers, using MinGW ld 
instead. DMC linker is not even a working linker.





remove file access denied

2018-09-13 Thread Josphe Brigmo via Digitalmars-d-learn

I am trying to remove a file

remove(filename);

and I get an access denied!

I can remove it from explorer just fine.

I am able to remove other files but there should be no reason why 
the file can't be removed in this case.


All I am doing to mess with the file is reading it's contents 
right before to do a file compare(I am removing the file if it is 
a duplicate).


Does read() lock the file at all? (maybe the lock is persisting 
just long enough to make the remove fail?


Since I can delete the file outside the program and since the 
filename is valid(I copied and pasted it to remove it to check), 
This seems like a D problem.




Re: Any free stock market data API?

2018-09-13 Thread Aldog via Digitalmars-d-learn

On Thursday, 4 January 2018 at 23:04:44 UTC, Amorphorious wrote:

Most are in other languages:

https://www.alphavantage.co/

https://iextrading.com/

are two free ones.

I'm just hoping for a more D'ish solution.


I know https://intrinio.com offers free financial data that can 
be accessed through a multitude of different methods. Try that 
out!


Re: Error: incompatible types for 'shared(SysTime)' and 'shared(SysTime)'

2018-09-13 Thread ag0aep6g via Digitalmars-d-learn

On 09/13/2018 03:25 PM, Arafel wrote:

     // How can we update the timestamp? Neither of those work
     timestamp = Clock.currTime;
     timestamp = cast(shared) Clock.currTime;


cast() timestamp = Clock.currTime;


Re: dip1000 issue

2018-09-13 Thread Steven Schveighoffer via Digitalmars-d-learn

On 9/7/18 7:59 AM, Orfeo wrote:

On Friday, 7 September 2018 at 14:36:18 UTC, rikki cattermole wrote:

On 08/09/2018 2:29 AM, Orfeo wrote:
==> And why (maybe a silly question) `-dip1000` breaks  my project so 
badly without warning..


DIP 1000 is an experimental addition to D, that is yet to be complete.
It is a compiler switch for a reason, it isn't ready for usage, only 
some experimentation.


Thank you very much...
I agree with you, but if someone adds `dip1000` in a library and I link 
it,  my project inherits this setting.

What do you think? is it correct? Some suggestions to avoid it?


The sub-project is being compiled with dip1000. I don't know what the 
rules are for dip1000 and dub, but it's likely the flags are propagated.


One of the main drawbacks of dip1000 is that if you don't have it 
enabled on ALL projects, you will likely run into linker errors. It's 
like compiling 2 libraries with different versions and expecting them to 
link. It's probably the reason dub forwards the switches.


Separately, if dmd is failing with signal 11 (SEGFAULT), this is a 
compiler bug. The compiler should never segfault.


At this point, it's hard to tell from what you have given what may cause 
the error. But maybe if your project is open source, you can file a bug 
with the link to the project? Or if you can narrow down the code in your 
project to a minimum that causes the error, it can be diagnosed further.


-Steve


Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread Jesse Phillips via Digitalmars-d-learn

On Monday, 10 September 2018 at 09:23:19 UTC, SuperPrower wrote:
dub was working nice until I updated my system (I run 
ArchLinux32) just now. dmd was updated from version 
1:2.081.2-1.0 to 1:2.082.0-1.0 (according to pacman package 
manager). After that, I couldn't invoke dub for anything. Here 
is the attempt to run `dub --vverbose`:


Can you find /usr/bin/dmd or run dmd?


Re: Error: incompatible types for 'shared(SysTime)' and 'shared(SysTime)'

2018-09-13 Thread Arafel via Digitalmars-d-learn

On 07/05/2016 04:16 PM, ag0aep6g wrote:

On 07/05/2016 07:25 AM, ketmar wrote:

cast `shared` away. yes, this is how you supposed to use it now: cast it
away.


after having ensured thread safety that is


Sorry to resurrect an old thread, but then how can one update a SysTime 
field in a shared class? Like this (using a synchronized class for 
simplicity, this part works and the mutex acts as expected):


```
import std.concurrency;
import std.datetime.systime;

import core.thread;

public synchronized shared class A {
public:
void doSomething() {
// Doing something takes a couple of seconds.
Thread.sleep(2.dur!"seconds");

// How can we update the timestamp? Neither of those work
timestamp = Clock.currTime;
timestamp = cast(shared) Clock.currTime;
}
private:
SysTime timestamp;
}

void main() {
shared A a = new shared A;
spawn( (shared A a) { a.doSomething;}, a );
Thread.sleep(1.dur!"seconds");
spawn( (shared A a) { a.doSomething;}, a );
}
```

Of course the kludge (and what I'll be doing) is just to use __gshared, 
but I expected this to be a convenience / hack to save you castings, 
rather than the only way to achieve it.


A.


Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread SuperPrower via Digitalmars-d-learn

On Thursday, 13 September 2018 at 06:11:53 UTC, rmc wrote:
There don't seem to be any changes to dub or dmd directly 
related to this error perhaps its a packaging issue?


I really don't know, looks like it, but it's really weird, like, 
why and what exactly happened? I'll try asking same question on 
ArchLinux32 forums - maybe, maintainer forgot something or I 
dunno.



Just out of curiosity; Why are you using ArchLinux32?


Pretty old laptop, only supports i686 systems. I don't really 
need anything else as I only use it for some hobby programming 
when I'm away from my desktop.


Re: Pass 'this' as reference

2018-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, September 13, 2018 4:04:58 AM MDT Jan via Digitalmars-d-learn 
wrote:
> Many thanks Adam and Steve! Works like a charm! :D
> I presumed classes are lvalues. I shouldn't make things more
> complicated than they are ;-)

Well, the variables _are_ lvalues. It's just that they're references to
objects rather than the objects themselves. You never refer to a class
object directly in D. Rather, you're always dealing with a reference to a
class object. Class references are basically pointers except that you can't
dereference them directly, just call member functions on them (which in D
means implicitly dereferencing whether you're talking about pointers or
class references). In that respect, they're like classes in Java. So, if you
assign a value to a class reference, you're assigning the reference, not the
class object itself, just like when you assign a value to a pointer, you're
mutating the pointer itself, not mutating the object that it points to.

- Jonathan M Davis





Re: Pass 'this' as reference

2018-09-13 Thread Jan via Digitalmars-d-learn

Many thanks Adam and Steve! Works like a charm! :D
I presumed classes are lvalues. I shouldn't make things more 
complicated than they are ;-)


Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread Kagamin via Digitalmars-d-learn

You didn't update dub?


Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread rmc via Digitalmars-d-learn

On Monday, 10 September 2018 at 09:23:19 UTC, SuperPrower wrote:
dub was working nice until I updated my system (I run 
ArchLinux32) just now. dmd was updated from version 
1:2.081.2-1.0 to 1:2.082.0-1.0 (according to pacman package 
manager). After that, I couldn't invoke dub for anything. Here 
is the attempt to run `dub --vverbose`:

[snip]
Full exception: 
object.Exception@source/dub/compilers/compiler.d(127): Failed 
to invoke the compiler /usr/bin/dmd to determine the build 
platform: Error: missing or null command line arguments

[snip]


There don't seem to be any changes to dub or dmd directly related 
to this error perhaps its a packaging issue?


https://github.com/dlang/dmd/blame/61fe641e9a5d40617d6d20aa1abc64e77c00b6ef/src/dmd/mars.d#L205

https://github.com/dlang/dub/blame/765cf8ea8bec9b8da05e41e4987f1b37f02305bc/source/dub/compilers/compiler.d#L127

Just out of curiosity; Why are you using ArchLinux32?

R


Re: Shared, ref, arrays, and reserve template instantiation

2018-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 12, 2018 9:42:19 PM MDT James Blachly via 
Digitalmars-d-learn wrote:
> Neia is right that I tried to cast as in the second case ( but
> without UFCS -- reserve( cast(int[]), N); ).  As an aside, what
> is going on behind the scenes with the compiler when casting away
> a property? I did not think cast operations copied data, so was
> surprised that a cast value is not an lvalue.

Well, you basically get a temporary variable when you cast an object, and
those are rvalues. And while casting with regards to type qualifiers such as
const or shared, you're not actually changing the data, plenty of other
casts do - e.g. float and long don't even have the same size, but you can
cast from one to the other. So, even in principle, only some casts could
result in lvalues even if we wanted them to.

- Jonathan M Davis