Re: A strategic vision for D

2018-05-04 Thread germandiago via Digitalmars-d

On Tuesday, 1 May 2018 at 12:26:25 UTC, Joakim wrote:
I realize it's right before the conference, but I'd like to put 
out a request for Walter and Andrei to spend five minutes 
during your talks laying out some overarching strategy for how 
you see D evolving. It could be during the keynotes or leading 
off the Q panel, but I think it's worth laying a broad 
strategy out there.


Specifically, what uses do you see D being put to for the next 
five years and how do we make it better in those directions.  
For example, in what way you'd like to see D get better as a 
language for writing apps, or what particular niches you see D 
as a systems language doing well in first.


For another example, here's what I'd say, ie my strategic 
vision: the pendulum is about to swing hard back towards the 
client, towards the billion and a half mobile devices sold each 
year, and D is ideally positioned with its native efficiency to 
do well there. However, since it's not the blessed language for 
any mobile platform, like Kotlin or Swift, it will take much 
work on libraries to pull that off.


Some caveats: since D is not controlled by a company with W 
as co-CEOs, they cannot obviously order people to follow their 
vision. However, that should leave you free to really share 
your unexpurgated thoughts, after all, we're all free to ignore 
it. ;)


Another is that perhaps D has chosen to evolve tactically as 
opposed to strategically, carefully picking off wins with a new 
feature or mode of programming but not following any grand 
strategy, similar to how Linus Torvalds claims he didn't have 
any grand vision for linux either. However, a strategic vision 
can inspire people to work towards that goal, if there is one 
to be shared.


My 2 cents. I have been following D for a long time and started 
using it in a very small project. I am a very long term C++ user.


Many people say that D does not offer anything over C++, 
improvements-wise. Or people tell you that there is Go and Rust. 
Because D does not have these fancy algebraic data types, or that 
borrow checker... no, no and NO. I think we do not need to enter 
that game. I have tried all 3. Here is my opinion.


1. Go --> excellent...!!! For what it does: namely, intensive 
communication client/server. It falls short of abstraction power 
in some areas, has no compile-time evaluation, no 
metaprogramming... though I must recognize it works pretty smooth 
for its simplicity.


2. Rust --> the borrow checker... excellent, in theory: in 
practice, as Andrei Alexandrescu once mentioned: you spend a lot 
of effort on something that in reality is not a problem most of 
the time. It is a problem, yes, but these problems can be avoided 
with much more lightweight solutions or simply, as D does, being 
able to avoid GC where it is needed. A much more practical 
solution. Rust has other things of value, such as Algebraic data 
types and Traits, but the borrow checker has a big impact for 
several reasons: it takes time to get used to, socially, people 
cannot use Rust from day one, so... you need added training for 
teams. But also remember... an "alien" type system makes it more 
difficult for integration with previous systems.


How should be D advertised? Well, I think that Ali Çehreli did a 
good job explaining in one of his keynotes the conveniencies of 
D, but this will not make people migrate. Why I am myself 
starting to take a look into D? I am a person that if I publish a 
project as open source, I want people to be able to contribute. 
Coding is, above all, a social activity, so:


- Come from Java, C#, want faster alternative? D will take little 
effort.
- Come from C, abstractions are too low level? D will take the 
same effort as alternatives with native performance, but you can 
start coding today.
- Come from C++ (like myself)? D is way cleaner and more 
convenient: modules, better metaprogramming, pervasive CTFE, 
*much better introspection* and also easy to learn.


Those are all good reasons, but, for me, what sets D apart is its 
level of integration with C/C++. If I come for D in the first 
place is because I can reuse my old code. This is true for most 
businesses: they have older code to integrate.


So my opinion is that D is a very pragmatic language that has 
this real, also management-perceivable advantages over all these 
nice algebraic data types integrated into the language and so on:


- if I pick up D in a team, it is very likely that D will be 
easier to pick up because many, many people know C++/Java/C# or 
similar things. This is a very important social factor and 
usually not mentioned or underestimated.
- if I have some C/C++ code to integrate, I can do it *way 
smoother* than with other languages to do it: please guys keep 
working on this.
- if I want safety, there are mechanisms that take you 90% there. 
Why would you pick up an alien like Rust where you have to 
relearn all, but not only that, you have to train full teams? 
This 

Re: Should 'in' Imply 'ref' as Well for Value Types?

2018-05-04 Thread Jesse Phillips via Digitalmars-d
Personally I would have expected the compiler to be free to 
choose what was needed. I'm sure that has complications with 
separate compilation.


Re: D as a college language

2018-05-04 Thread Jesse Phillips via Digitalmars-d
I believe D has had the biggest impact on my programming skills, 
not so much CS.


D was great because I could try to do the Java assignment in D 
too, and the same for my C class. Not so much c++.


As you say you can cover different levels with D.


Re: D as a college language

2018-05-04 Thread KingJoffrey via Digitalmars-d

On Friday, 4 May 2018 at 11:35:22 UTC, Sjoerd Nijboer wrote:


I think D could play a bigger role in education since its such 
a "clean" language that is flexible but doesn't have any real 
gotcha "features".


Umm, that is completely untrue, as it is for pretty much any 
programming language.


Its also a language that could potentially be used over 
someones entire college career as the primary language. If this 
would be achieved there would be a higher income flow into the 
industry of young D programmers which will pollute other 
programmers with the D mind and featureset.


No!!!

Students should learn C first, Java second. Not one or the other, 
both!


Then, perhaps, they will begin to understand the basics of 
computer programming - from both extremes.


D could be a postgrad interest perhaps.

And what's earning an income got to do with anything? It's a 
stupid concept that humans have imposed on themselves, and it's 
the primary cause of all things that are wrong with society. The 
sooner we move to universal incomes, the better grauate 
programmers we'll get, cause they'll be studying it because it 
actually interests them, as opposed to being motived by its' 
'earning' capacity.





[Issue 18667] Segfault in std.file.dirEntries

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18667

greenify  changed:

   What|Removed |Added

 CC||greeen...@gmail.com

--- Comment #3 from greenify  ---
See also: https://github.com/dlang-community/D-Scanner/pull/624

--


Re: Store any callable in an array

2018-05-04 Thread Neia Neutuladh via Digitalmars-d-learn

On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote:
If toDelegate isn't (always) @safe, how can you be sure that 
your wrapper is?


If it were @safe, the compiler would accept it.

Looking at the code, I believe there are several casts that the 
compiler can't verify but are used safely.



Also, TFunc may have an unsafe destructor.


If it's a delegate with an un-@safe destructor (how would that 
work? a captured context variable?), then it's already not @safe. 
If it's a function, it doesn't have a destructor. If it's a 
user-defined type with opCall, that's something to pay attention 
to, but it's beyond the scope of the original question.


Re: Need help with the dmd package on NixOS

2018-05-04 Thread Johannes Loher via Digitalmars-d
Am 04.05.2018 um 22:27 schrieb Thomas Mader:
> [...]
Here is a demangled version of what you posted:

dmd hello.d
hello.o: In function `@safe void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])':
hello.d:(.text.@safe void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])[@safe
void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])]+0x46):
undefined reference to `@safe std.stdio.File.LockingTextWriter
std.stdio.File.lockingTextWriter()'
hello.d:(.text.@safe void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])[@safe
void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])]+0x57):
undefined reference to `@safe void std.stdio.File.__dtor()'
hello.d:(.text.@safe void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])[@safe
void
std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])]+0xa4):
undefined reference to `@trusted void
std.stdio.File.LockingTextWriter.__aggrDtor()'
hello.o:(.data.DW.ref.__dmd_personality_v0+0x0): undefined reference to
`__dmd_personality_v0'
hello.o: In function `@safe int std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])':
hello.d:(.text.@safe int std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])[@safe int
std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])]+0x20): undefined
reference to `std.exception.ErrnoException.__Class'
hello.d:(.text.@safe int std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])[@safe int
std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])]+0x5b): undefined
reference to `@trusted std.exception.ErrnoException
std.exception.ErrnoException.__ctor(immutable(char)[],
immutable(char)[], ulong)'
hello.d:(.text.@safe int std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])[@safe int
std.exception.errnoEnforce!(int,
"/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d",
2877uL).errnoEnforce(int, lazy immutable(char)[])]+0x63): undefined
reference to `_d_throwdwarf'
hello.o: In function `@safe void
std.stdio.File.LockingTextWriter.put!(immutable(char)).put(immutable(char))':

Unfortunately, I don't have any clue what might be going on...


Re: Error: module `hello` is in file 'hello.d' which cannot be read

2018-05-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, May 04, 2018 at 11:29:12PM +, Alex via Digitalmars-d-learn wrote:
> Hi
> 
> I just installed D on my windows 10 and want to try to compile a hello
> world. My source is a classical
> 
> import std.stdio;
> void main() {
> writeln("Hello, World!");
> }
> 
> And I try to compile and get
> 
> C:\D>dmd hello.d
> Error: module `hello` is in file 'hello.d' which cannot be read
> import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
> import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
> 
> What do I do wrong ?
> 
> D is installed at de root of C:, and the hello.d source code is at
> C:\D\dmd2\sources.
[...]

Where is your current directory?  If hello.d is in C:\D\dmd2\sources
then you need to:

C:
cd \D\dmd2\sources
dmd hello.d


T

-- 
Life begins when you can spend your spare time programming instead of
watching television. -- Cal Keegan


Error: module `hello` is in file 'hello.d' which cannot be read

2018-05-04 Thread Alex via Digitalmars-d-learn

Hi

I just installed D on my windows 10 and want to try to compile a 
hello world. My source is a classical


import std.stdio;
void main() {
writeln("Hello, World!");
}

And I try to compile and get

C:\D>dmd hello.d
Error: module `hello` is in file 'hello.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import

What do I do wrong ?

D is installed at de root of C:, and the hello.d source code is 
at C:\D\dmd2\sources.


Thank you to you

Alex



[Issue 17546] Cannot call .stringof on a function symbol if it does not have a no-args overload

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17546

Basile B.  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #4 from Basile B.  ---
Phobos is affected https://issues.dlang.org/show_bug.cgi?id=13741

--


Re: DConf 2018 Livestream

2018-05-04 Thread meppl via Digitalmars-d-announce

On Friday, 4 May 2018 at 06:19:13 UTC, meppl wrote:

On Friday, 4 May 2018 at 04:39:16 UTC, Nemanja Boric wrote:
On Friday, 4 May 2018 at 00:09:53 UTC, Nick Sabalausky 
(Abscissa) wrote:

On 05/03/2018 11:12 AM, Nemanja Boric wrote:

[...]


It's working for me:
https://www.youtube.com/watch?v=0UZuRNujLGQ

Maybe youtube just needed some time after the original stream 
ended before it could do replays of the whole thing.


Looks like it, it works for me now as well!

This looks like to be the first day (or recorded part of it): 
https://www.youtube.com/watch?v=HvqsUO77FGI


The second day (from your post): 
https://www.youtube.com/watch?v=0UZuRNujLGQ




no, its the other way around. also, "walter bright"-talk and 
some other are still missing


ah, sorry, i was confused. the order is right. but some 
presentations are really missing/lost


[Issue 18828] New: [-betterC] helpless error in object.d

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18828

  Issue ID: 18828
   Summary: [-betterC] helpless error in object.d
   Product: D
   Version: D2
  Hardware: All
   URL: http://dlang.org/
OS: Windows
Status: NEW
  Severity: blocker
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: flamaros.xav...@gmail.com

I am trying do a custom opengl32.dll, all my code is already tagged with @nogc,
but when I enable the -betterC option I get the following error that isn't
really helpful. 
The error comes from the function destroy implementation, but I can't figure
out from where it is called in my code.


-- Début de la génération : Projet : opengl32, Configuration : debug Win32
--
Building D:\Dev\Personal\ToVulkanPoc\bin\opengl32.dll...
D:\Softs\D\dmd2\windows\bin\..\..\src\druntime\import\object.d(3035): Error:
`TypeInfo` cannot be used with -betterC
Building D:\Dev\Personal\ToVulkanPoc\bin\opengl32.dll failed!
Details saved as
"file://D:\Dev\Personal\ToVulkanPoc\opengl32\.dub\obj\debug\dummy\dummy\opengl32\opengl32.buildlog.html"
== Génération : 0 a réussi, 1 a échoué, 1 mis à jour, 0 a été ignoré
==

--


Re: DConf 2018 Livestream

2018-05-04 Thread Juan via Digitalmars-d-announce

On Friday, 4 May 2018 at 20:29:06 UTC, bachmeier wrote:

On Friday, 4 May 2018 at 20:05:12 UTC, Juan wrote:

On Friday, 4 May 2018 at 04:39:16 UTC, Nemanja Boric wrote:

Looks like it, it works for me now as well!

This looks like to be the first day (or recorded part of it): 
https://www.youtube.com/watch?v=HvqsUO77FGI


The second day (from your post): 
https://www.youtube.com/watch?v=0UZuRNujLGQ


Does anybody the link from today presentation?


https://www.youtube.com/watch?v=e5HsyEnyvlM


Thanks!


Re: DConf 2018 Livestream

2018-05-04 Thread bachmeier via Digitalmars-d-announce

On Friday, 4 May 2018 at 20:05:12 UTC, Juan wrote:

On Friday, 4 May 2018 at 04:39:16 UTC, Nemanja Boric wrote:

Looks like it, it works for me now as well!

This looks like to be the first day (or recorded part of it): 
https://www.youtube.com/watch?v=HvqsUO77FGI


The second day (from your post): 
https://www.youtube.com/watch?v=0UZuRNujLGQ


Does anybody the link from today presentation?


https://www.youtube.com/watch?v=e5HsyEnyvlM


Need help with the dmd package on NixOS

2018-05-04 Thread Thomas Mader via Digitalmars-d
The dmd package on NixOS doesn't work anymore in their master 
branch.
They must have changed something in the C environment or 
something and I don't have a clue what's going on.
Building the package succeeds but when I try to build with the 
newly build binary I get all sorts of linker errors.

Maybe someone can give me some hints?
Here you see a small piece of the output if I try to build a 
simple hello world with it.


dmd hello.d
hello.o: In function `_D3std5stdio__T7writelnTAyaZQnFNfQjZv':
hello.d:(.text._D3std5stdio__T7writelnTAyaZQnFNfQjZv[_D3std5stdio__T7writelnTAyaZQnFNfQjZv]+0x46):
 undefined reference to 
`_D3std5stdio4File17lockingTextWriterMFNfZSQBoQBnQBk17LockingTextWriter'
hello.d:(.text._D3std5stdio__T7writelnTAyaZQnFNfQjZv[_D3std5stdio__T7writelnTAyaZQnFNfQjZv]+0x57):
 undefined reference to `_D3std5stdio4File6__dtorMFNfZv'
hello.d:(.text._D3std5stdio__T7writelnTAyaZQnFNfQjZv[_D3std5stdio__T7writelnTAyaZQnFNfQjZv]+0xa4):
 undefined reference to `_D3std5stdio4File17LockingTextWriter10__aggrDtorMFNeZv'
hello.o:(.data.DW.ref.__dmd_personality_v0+0x0): undefined 
reference to `__dmd_personality_v0'
hello.o: In function 
`_D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi':

hello.d:(.text._D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi[_D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi]+0x20):
 undefined reference to `_D3std9exception14ErrnoException7__ClassZ'
hello.d:(.text._D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi[_D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi]+0x5b):
 undefined reference to 
`_D3std9exception14ErrnoException6__ctorMFNeAyaQdmZCQBxQBwQBp'
hello.d:(.text._D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi[_D3std9exception__T12errnoEnforceTiVAyaa83_2f6e69782f73746f72652f783977667070677a30377a676b733979666e37633936393635776d726c3078642d646d644275696c642d322e3037392e312f696e636c7564652f64322f7374642f737464696f2e64Vmi2877ZQHqFNfiLQHhZi]+0x63):
 undefined reference to `_d_throwdwarf'
hello.o: In function 
`_D3std5stdio4File17LockingTextWriter__T3putTyaZQiMFNfyaZv':


Thanks in advance
Thomas



Re: Derelict on Ubuntu with CODE::BLOCKS

2018-05-04 Thread RegeleIONESCU via Digitalmars-d-learn

On Thursday, 3 May 2018 at 19:30:48 UTC, Mike Parker wrote:

On Thursday, 3 May 2018 at 18:36:04 UTC, RegeleIONESCU wrote:



[...]



So your app is compiling and executing. This is a runtime 
error. The SymbolLoadException means the SDL library was 
loaded, but a function Derelict expected to find was not there. 
This usually means that your version of Derelict by default 
supports a different version of SDL than you have on your 
system.


[...]


It works, even when loading all the libraries. I played with 
different versions and loaded libraries one by one to see how it 
works. I even managed to make a window - for me it is a big thing.


Thank you, thank you, thank you for your kind and detailed 
support!


Re: DConf 2018 Livestream

2018-05-04 Thread Juan via Digitalmars-d-announce

On Friday, 4 May 2018 at 04:39:16 UTC, Nemanja Boric wrote:

Looks like it, it works for me now as well!

This looks like to be the first day (or recorded part of it): 
https://www.youtube.com/watch?v=HvqsUO77FGI


The second day (from your post): 
https://www.youtube.com/watch?v=0UZuRNujLGQ


Does anybody the link from today presentation?




Re: Is HibernateD dead?

2018-05-04 Thread Matthias Klumpp via Digitalmars-d-learn
I've written an email to Vadim, maybe we get a reply on the 
status of both projects.



On Friday, 4 May 2018 at 07:18:09 UTC, bauss wrote:

[...]
Would it maybe be easier for you to base on ddbc[1] or another 
existing abstraction layer for database abstraction?
Ddbc is pretty neat, and even has support for reading structs 
directly from the database.




Perhaps, but it'd have to be a forked version as I don't really 
want to depend on something that isn't updated regularly.


ddbc's last commit was a year ago.


Yes, at the moment using ddbc and relying on it would mean taking 
over some maintenance of it. Ddbc is fairly complete though and 
might save you a lot of work, because it already abstracts a lot 
of (relational) database systems.



I can't seem to find a license for it though?


It's Boost licensed (BSL-1.0), but probably needs an explicit 
LICENSE file.
Maybe we can move ddbc to dlang-community, so more people can 
easily commit changes to it (provided it gets accepted there, and 
Vadim agrees with that move as well).


Perhaps I will end up having another "optional" dependency to 
it as a temporary until I can have a better implementation or 
something.


Taking over maintenance of it might be easier than reimplementing 
the database abstraction again though.
For Postgres, ddbc worked really well for me, and I assume its 
SQLite, MySQL and ODBC drivers are also still working well, 
meaning less work for you.
Without ddbc, you'd have to write new abstraction on top of some 
other libraries, like dpq2.


The frontend part of postgresql is almost finished, it's just 
having the postgresql driver working properly, which is where 
it's frozen right now.


Hmm... Does any public code for that exist already that I 
could play around with?
Unfortunately, I have a few more unusual requirements for 
Postgres, like:

 * UUIDs as primary keys, instead of integers


As far as I remember the implementation of @DbId in Diamond, 
then it supports whatever type.


Native support for std.uuid.UUID would be neat :-) For Hibernated 
I use a mixin to convert a UUID into strings transparently, for 
database insertion.



Diamond doesn't care much about what type your primary key is.

I will make sure that's how it function of course, if it 
currently doesn't behave like it, but I'm pretty sure it does.


 * Ability to register custom datatypes with the ORM (version 
numbers in this case, the ORM can view them as text, but the 
database has a special type for them)


That could be done with some attribute that lets you handle 
columns yourself.


Do you have a good name for it?

I was thinking @DbProxy and then the function would be 
something like:

[...]


Registering a new type with Postgres yields a new OID to identify 
the type, so I would need a function to tell the Postgres backend 
to treat OIDs of a certain number like "text" types. Ideally, I 
would also need to annotate entity to set a specific column type, 
like:


```
class Entity {
UUID uuid;

@ColumType("versionnumber")
string _version;
}
```
(With the result of CREATE TABLE not setting a "text" type for 
the new version column, but a "versionnumber" type instead)


That would do it. For Hibernated, I have Hibernated create the 
table initially, and then fire an ALTER TABLE at it afterwards to 
change the column type, while at the same time registering the 
new type OID with ddbc to be treated as text.
As said, this is a very specific requirement very few people will 
have ^^


Much more frequently people will ask for JSONB and JSON type 
support for a postgres driver though, I guess. For that, 
specifying the column type explicitly could be quite helpful as 
well, so switch between JSONB and JSON.


 * Obviously the usual ORM stuff, one-to-many, many-to-many, 
etc. relations




Yes, relations is one thing I haven't added and I have been 
wanting to do it for a while.


I will definitely look into having it added as well.


That's kind of key for an ORM :-) Handling relations manually was 
what made me abandon my "I just write raw SQL for everything" 
ways, because it gets quite complex and annoying in the long run.


(Obviously not a must-have list, I added support for custom 
datatypes to my ddbc fork as well, because it's not really a 
feature many people need)


Well, that's kind of the key to most of the development in 
Diamond.


I usually add functionality that isn't widely used and in most 
cases people implement it themselves ex. the whole diamond.seo 
is not usually something a framework has.


I keep an eye on it - at the moment, Vibe.d satisfies all 
requirements I have on a web framework, but that might change.
A well integrated ORM would certainly be a game changer, since 
Vibe.d is limited to Mongo and Redis only.


Diamond is a neat project, I played around with it about half 
a year ago, but didn't test the ORM part at all back then.


It wasn't that good back then and has improved a lot since, as 
well many other 

[Issue 18826] [inline asm] Wrongcode for mov

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18826

ag0aep6g  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||ag0ae...@gmail.com

--


Re: DConf hackathon track document

2018-05-04 Thread Basile B via Digitalmars-d-announce

On Friday, 4 May 2018 at 16:41:18 UTC, Seb wrote:
As the DConf hackathon is coming up soon, we created a quick 
document to list the tracks people will be working:


https://docs.google.com/document/d/1qrn7JZS62hzsylpGM1VhaT6YW2I1NVDDGQsANv5b1GQ/edit

If you already have an idea or want to start a new group, now 
is the time to add yourself to the track document.


Happy hacking tomorrow!


Maybe add 7804 to the list. 
(https://github.com/dlang/dmd/pull/8031). The feature can be 
split in two parts. The first was done. The feature branch is 
still there but i've abandoned it after a month without updating.


Re: On emulating C++ Namespaces (don't ask why)

2018-05-04 Thread Manu via Digitalmars-d
On 4 May 2018 at 10:50, 0x via Digitalmars-d
 wrote:
> What am I violating here apart from the truth that our Mr. Walter doesn't
> like namespaces:
>
> interface tlvs
> {
>   enum tlv { addr };
>
>static:
>   void header();
> }
>
> Is this cool?
>
> Thanks

But... modules?


Re: Store any callable in an array

2018-05-04 Thread ag0aep6g via Digitalmars-d-learn

On 05/04/2018 06:33 PM, Neia Neutuladh wrote:

auto asDelegate(TFunc)(TFunc func) @trusted
{
     import std.functional : toDelegate;
     return toDelegate(func);
}

The "@trusted" means that you promise this thing is safe, even if the 
compiler can't be certain.


If toDelegate isn't (always) @safe, how can you be sure that your 
wrapper is? Also, TFunc may have an unsafe destructor.


That's not good use of `@trusted`.


Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Kagamin via Digitalmars-d-learn
If you just want to clean logs, then use modification time on all 
oses:


auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
 dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => 
a.isFile).map!(a => tuple(a.name, a.timeLastModified)));

 return dFiles;
}


[Issue 13741] std.traits.moduleName does not work with functions that have parameters

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13741

Basile B.  changed:

   What|Removed |Added

Summary|std.traits.moduleName!Foo   |std.traits.moduleName does
   |gives a compile error for a |not work with functions
   |function with parameters|that have parameters

--


Re: On emulating C++ Namespaces (don't ask why)

2018-05-04 Thread Radu via Digitalmars-d

On Friday, 4 May 2018 at 17:50:59 UTC, 0x wrote:
What am I violating here apart from the truth that our Mr. 
Walter doesn't like namespaces:


interface tlvs
{
  enum tlv { addr };

   static:
  void header();
}

Is this cool?

Thanks


`final abstract class` is what you are looking for.


[Issue 13741] std.traits.moduleName!Foo gives a compile error for a function with parameters

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13741

Basile B.  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com
   Hardware|x86_64  |All
 OS|Windows |All

--


Entity 1.3.1 released, stable APIs and enhancements.

2018-05-04 Thread Brian via Digitalmars-d-announce
Entity is an object-relational mapping tool for the D programming 
language. Referring to the design idea of JPA. support PostgreSQL 
/ MySQL / SQLite.


## Support databases

PostgreSQL 9.0+
MySQL 5.1+
SQLite 3.7.11+

## Depends

database

## Simple code

import entity;

@Table("user")
class User : Entity
{
@PrimaryKey
@AutoIncrement
int id;

string name;
double money;
string email;
bool status;
}

void main()
{
DatabaseOption options = new 
DatabaseOption("mysql://root:123456@localhost:3306/huntblog?charset=utf-8");
EntityManagerFactory entityManagerFactory = 
Persistence.createEntityManagerFactory("default", options);

EntityManager em = entityManagerFactory.createEntityManager();

// begin transaction
em.getTransaction().begin();

// define your database existing row id in here
int id = 10;

auto user = em.find!User(id);
log("User name is: ", user.name);

// commit transaction
em.getTransaction().commit();

em.close();
entityManagerFactory.close();
}

## Insert row

auto user = new User();
user.name = "Brian";
user.email = "br...@huntlabs.cn";
user.money = 99.9;

// insert user
em.persist(user);
log("User id is: ", user.id);

## Delete row

int n = em.remove!User(id);
log("The member of users deleted is: ", n);

## Update row

auto user = em.find!User(id);
log("User name is: ", user.name);
user.name = "zoujiaqing";
em.merge!User(user);
log("The number of users updated is: ", n);

## Use CriteriaQuery to find

// create CriteriaBuilder object from em
CriteriaBuilder builder = em.getCriteriaBuilder();

CriteriaQuery!User criteriaQuery = builder.createQuery!User;
Root!User root = criteriaQuery.from();
Predicate p1 = builder.equal(root.User.id, id);
TypedQuery!User typedQuery = 
em.createQuery(criteriaQuery.select(root).where(p1));


auto user =  cast(User)(typedQuery.getSingleResult());

log("User name is: ", user.name);

## Use CriteriaQuery to Multi-condition find

// create CriteriaBuilder object from em
CriteriaBuilder builder = em.getCriteriaBuilder();

CriteriaQuery!User criteriaQuery = builder.createQuery!User;
Root!User root = criteriaQuery.from();

Predicate p1 = builder.lt(root.User.id, 1000);  // User id is 
less than 1000.
Predicate p2 = builder.gt(root.User.money, 0);  // User money 
is greater than 0.
Predicate p3 = builder.like(root.User.name, "z%");  // User 
name prefix is z.


TypedQuery!User typedQuery = 
em.createQuery(criteriaQuery.select(root).where(builder.and(p1, 
p2), p3));

User[] users typedQuery.getResultList();

log("The number of users found is: ", users.length);

## Links

http://code.dlang.org/packages/entity
https://github.com/huntlabs/entity



On emulating C++ Namespaces (don't ask why)

2018-05-04 Thread 0xFFFFFFFF via Digitalmars-d
What am I violating here apart from the truth that our Mr. Walter 
doesn't like namespaces:


interface tlvs
{
  enum tlv { addr };

   static:
  void header();
}

Is this cool?

Thanks


Re: D vs nim

2018-05-04 Thread Timothee Cour via Digitalmars-d
i think the explanation in
https://nim-lang.org/docs/manual.html#statements-and-expressions-when-statement
is pretty clear. In any case you can see for yourself:
nim c -r main.nim
```nim
proc fun(a:int):auto=a*a
static: # makes sure block evaluated at CT
   when fun(1)==1: echo "ok1"
   when fun(2)==2: echo "ok2"
```
prints ok1


On Fri, May 4, 2018 at 9:40 AM Mark via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On Thursday, 3 May 2018 at 23:09:34 UTC, Timothee Cour wrote:
> > nim supports static if (`when`) + CTFE. A simple google search
> > or searching
> > would've revealed that.
> >
> > On Thu, May 3, 2018 at 3:20 PM Mark via Digitalmars-d <
> > digitalmars-d@puremagic.com> wrote:
> >
> >> On Thursday, 3 May 2018 at 20:57:16 UTC, Dennis wrote:
> >> > On Thursday, 3 May 2018 at 19:11:05 UTC, Mark wrote:
> >> >> Funnily, none of these languages have a "static if"
> >> >> construct, nor do Rust, Swift and Nim. Not one that I could
> >> >> find, anyway.
> >> >
> >> > What qualifies under "static if"? Because Rust, Swift and
> >> > Nim do have conditional compilation.
> >> >
> >
https://doc.rust-lang.org/book/first-edition/conditional-compilation.html
> >> >
> >
https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html
(conditional compilation blocks)
> >> >
> >
https://nim-lang.org/docs/manual.html#statements-and-expressions-when-statement
> >
> >> Fair enough. I should have written "static if + CTFE".

> The little information on the official site describes `when` more
> like #ifdef in C than an actual static if. I also went over a few
> dozens of modules in the standard library and the statement seems
> to be rarely used, and when it does it's usually in an #ifdef-ish
> context (like platform specific code).

> Perhaps Nim's support for conditional compilation is as powerful
> as D's is, but you can see why my impression is currently to the
> contrary.


Re: std.regex horribly broken in 2.080?

2018-05-04 Thread Dmitry Olshansky via Digitalmars-d

On Friday, 4 May 2018 at 14:33:09 UTC, Dmitry Olshansky wrote:

On Friday, 4 May 2018 at 11:39:18 UTC, WebFreak wrote:
I am currently working on workspace-d/serve-d but I am 
continously running into segfaults with std.regex ctRegex with 
the captures in dub and dscanner. I can't provide any other 
information really because my internet is dead right now. This 
issue is happening all the time there, yet I can't reproduce 
it. Can someone with internet maybe check where that issue 
might come from?


I think I see the code where the trace comes from. Might take a 
shot at hackathon.




I could take a look. Any chance to have the exact reproduction 
steps?


By the look of it something is wrong with Captures struct being 
destroyed twice or something. Could also be compiler issue.


Another thing is to disable inlining and I could at least see 
detailed stack trace.




[...]





Re: DConf hackathon track document

2018-05-04 Thread rikki cattermole via Digitalmars-d-announce

On 05/05/2018 4:41 AM, Seb wrote:
As the DConf hackathon is coming up soon, we created a quick document to 
list the tracks people will be working:


https://docs.google.com/document/d/1qrn7JZS62hzsylpGM1VhaT6YW2I1NVDDGQsANv5b1GQ/edit 



If you already have an idea or want to start a new group, now is the 
time to add yourself to the track document.


Happy hacking tomorrow!


I've added some simple work to improve dmd as a library.
Two out of the three will require a decision from Walter (simple 
though!) and all three can be done by pretty much anyone!


I'll also add a note regarding shared redesign (since that was mentioned 
that was desired) along with my draft idea for it.


Re: auto: useful, annoying or bad practice?

2018-05-04 Thread H. S. Teoh via Digitalmars-d
On Fri, May 04, 2018 at 12:12:09AM -0400, Nick Sabalausky (Abscissa) via 
Digitalmars-d wrote:
[...]
> The problem with structural typing is that it's unable to distinguish
> between intended matches and accidental, unintended matches. This is
> because it doesn't REQUIRE types/functions/etc to clearly state, "Yes,
> I *intend* to be implementing interface XYZ". Or perhaps more
> accurately: "Yes, I *intend* for this to satisfy isXYZ!T". (Where
> "isXYZ" might be something like "isInputRange" or "isInfiniteRange",
> or both, etc.)
> 
> Note the all-caps "REQUIRE" in the paragraph above. That is to say,
> it's not enough for the developer of struct Foo to toss in...
> 
> static assert(isXYZ!Foo);
> 
> ...because the problem doesn't lie with the "intended matches". The
> problem lies with the "unintended matches". And that static assert
> does nothing to help isXYZ figure out that some other type, Bar, from
> some other package, is NOT deliberately designed to satisfy isXYZ even
> if it just happens to *look* like it satisfies it purely by chance.

This is a good point.  However, I'm failing to see it as a big problem,
because for it to be a problem in the first place, you have to have
*deliberately* passed an object of said type into a function that
expects that particular concept.  Using your previous example, if
somebody declared a JackInTheBox type that "accidentally" has .front,
.popFront, .empty but not actually intending to be an input range, this
is not a problem until you *explicitly* pass a JackInTheBox to something
that expects an input range.  Just because JackInTheBox happens to
accidentally implement the input range API without intending to have
input range semantics, doesn't by itself cause any problem.  As long as
you don't try passing it off as an input range, there's nothing to worry
about.

And even when this explicit passing is done, what's the worst that could
happen?  The JackInTheBox wouldn't actually implement input range
functionality and would cause a bug.  So you'd just debug it like you
would debug any other problem.

I'm not saying it's ideal, but it doesn't seem to be the huge big
problem that people are making it out to be.


[...]
> So back you your question: How else would you do DoI?
> 
> Answer: By making isXYZ!T reject all T which DO NOT satisfy a
> deliberate, cannot-be-an-accident, condition of isXYZ's choosing.
> 
> Thus, type T *cannot* satisfy isXYZ without T's developer saying "Yes,
> I hereby certify it is my deliberate intention that T satisfies isXYZ
> and that, if it does satisfy, it is by my own intention and not by
> coincidental happenstance."
> 
> The exact details of this condition aren't terribly important, but I
> like Neia's suggestion of utilizing UDAs for this purpose. An old idea
> I had before UDAs existed was to require a dummy member enum named
> something like _satisfies_module_foo_bar_isXYZ, which of course would
> be abstracted away by something more convenient...a mixin or such (but
> nobody seemed remotely interested). But I like the UDA idea better.

Yeah, the UDA idea is a pretty good one.  I might even adopt it in my
code. :-)


T

-- 
Fact is stranger than fiction.


DConf hackathon track document

2018-05-04 Thread Seb via Digitalmars-d-announce
As the DConf hackathon is coming up soon, we created a quick 
document to list the tracks people will be working:


https://docs.google.com/document/d/1qrn7JZS62hzsylpGM1VhaT6YW2I1NVDDGQsANv5b1GQ/edit

If you already have an idea or want to start a new group, now is 
the time to add yourself to the track document.


Happy hacking tomorrow!


Re: D vs nim

2018-05-04 Thread Mark via Digitalmars-d

On Thursday, 3 May 2018 at 23:09:34 UTC, Timothee Cour wrote:
nim supports static if (`when`) + CTFE. A simple google search 
or searching

would've revealed that.

On Thu, May 3, 2018 at 3:20 PM Mark via Digitalmars-d < 
digitalmars-d@puremagic.com> wrote:



On Thursday, 3 May 2018 at 20:57:16 UTC, Dennis wrote:
> On Thursday, 3 May 2018 at 19:11:05 UTC, Mark wrote:
>> Funnily, none of these languages have a "static if" 
>> construct, nor do Rust, Swift and Nim. Not one that I could 
>> find, anyway.

>
> What qualifies under "static if"? Because Rust, Swift and 
> Nim do have conditional compilation.

>

https://doc.rust-lang.org/book/first-edition/conditional-compilation.html

>

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html
 (conditional compilation blocks)

>

https://nim-lang.org/docs/manual.html#statements-and-expressions-when-statement


Fair enough. I should have written "static if + CTFE".


The little information on the official site describes `when` more 
like #ifdef in C than an actual static if. I also went over a few 
dozens of modules in the standard library and the statement seems 
to be rarely used, and when it does it's usually in an #ifdef-ish 
context (like platform specific code).


Perhaps Nim's support for conditional compilation is as powerful 
as D's is, but you can see why my impression is currently to the 
contrary.


Re: Store any callable in an array

2018-05-04 Thread Neia Neutuladh via Digitalmars-d-learn

On Friday, 4 May 2018 at 15:36:29 UTC, wjoe wrote:
I have a class that I want to be able to register callbacks and 
I'd like to be able to register any callable - functions, 
delegates, lambdas, anything.


Is there another way to do it besides converting those 
toDelegate, which states a bug with @safe functions?


Or better store each type in their own array ?

Cheers!


auto asDelegate(TFunc)(TFunc func) @trusted
{
import std.functional : toDelegate;
return toDelegate(func);
}

The "@trusted" means that you promise this thing is safe, even if 
the compiler can't be certain.


Re: Ambiguous template parameter names

2018-05-04 Thread jmh530 via Digitalmars-d-learn

On Thursday, 3 May 2018 at 13:30:03 UTC, bauss wrote:

On Thursday, 3 May 2018 at 02:51:18 UTC, Meta wrote:


If you want that, you might be able to do `int val = val` on 
the inner function, though I'm not sure that'll work.


It does not work and will do nothing.


Below compiles, but my guess is that the ASM is saying that the 
foo function only has a run-time argument.


template foo(int val)
{
int foo(int val = val)
{
return val;
}
}

void main()
{
assert(foo!1 == 1);
assert(foo!1(2) == 2);
}


Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn

On Friday, 4 May 2018 at 15:37:28 UTC, ag0aep6g wrote:

On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:

How can I use the following c structure from d.

struct Item
{
  int id;
};

struct Group
{
  int i;
  int item_count;
  struct Item items[];
};

tried defining items[] as both "Item[] items" and "Item* 
items" in d, it compiles okay but gives an error when trying 
to access it.


Here is the error.
object.Error@(0): Access Violation


In the C code, the elements of `items` are directly part of the 
struct. There is no indirection. D doesn't have dedicated 
syntax for this, but you can hint at it with a zero-sized array:


struct Group
{
int i;
int item_count;
Item[0] items;
}

Then access an item with `group.items.ptr[index]`.


Hi ag0aep6g,

Thanks a lot for that.

I should have thought of that (i would still have missed the .ptr 
part), the old c syntax for the same thing used to be "Item 
items[0]".


Thanks,
NewUser





Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread wjoe via Digitalmars-d-learn

On Friday, 4 May 2018 at 15:30:26 UTC, Vino wrote:

On Friday, 4 May 2018 at 15:16:23 UTC, wjoe wrote:

[...]


Hi Wjoe,

  Thank you very much, but what i am expecting is something 
like OS switch, based of OS type switch the funciton eg:


If OS is windows use the funciton timeCreated else if the OS is 
linux use the function timeLastAccessed in the below example 
program, something similar as stated in the link


https://dlang.org/spec/declaration.html#alias

Eg1:
version (Win32)
{
alias myfoo = win32.foo;
}
version (linux)
{
alias myfoo = linux.bar;
}



auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;


version (Windows) {  alias sTimeStamp = 
std.file.DirEntry.timeCreated;} else version (linux) { alias 
sTimeStamp = std.file.DirEntry.timeLastAccessed; }



dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => 
a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));

 return dFiles;
}

From,
Vino.B


I think that's not possible. You can't query information that 
hasn't been stored.


Your best bet in a Change-Function-Name-Port would probably be to 
use access time and mount the file system with options that won't 
touch that anymore after creation. But me thinks such a solution 
would be rather unreliable and not worth the time investment.


Re: D as a college language

2018-05-04 Thread bachmeier via Digitalmars-d

On Friday, 4 May 2018 at 15:22:17 UTC, rikki cattermole wrote:

Teaching materials is easy to create.


They are, but professional quality teaching materials are not 
easy to create. Bad teaching materials are a net negative. The 
things I see presented in this forum, for instance, indicate that 
not many around here would not be able to teach a college class.



My response is the response I got from my institution.
It is industry usage which is the problem.


That depends on the institution and the goals of the class.




Store any callable in an array

2018-05-04 Thread wjoe via Digitalmars-d-learn
I have a class that I want to be able to register callbacks and 
I'd like to be able to register any callable - functions, 
delegates, lambdas, anything.


Is there another way to do it besides converting those 
toDelegate, which states a bug with @safe functions?


Or better store each type in their own array ?

Cheers!


Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread ag0aep6g via Digitalmars-d-learn

On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:

How can I use the following c structure from d.

struct Item
{
  int id;
};

struct Group
{
  int i;
  int item_count;
  struct Item items[];
};

tried defining items[] as both "Item[] items" and "Item* items" 
in d, it compiles okay but gives an error when trying to access 
it.


Here is the error.
object.Error@(0): Access Violation


In the C code, the elements of `items` are directly part of the 
struct. There is no indirection. D doesn't have dedicated syntax 
for this, but you can hint at it with a zero-sized array:


struct Group
{
int i;
int item_count;
Item[0] items;
}

Then access an item with `group.items.ptr[index]`.


Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn

On Friday, 4 May 2018 at 15:16:23 UTC, wjoe wrote:

On Friday, 4 May 2018 at 14:24:36 UTC, Vino wrote:

On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote:
On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn 
wrote:

[...]


Linux does not keep track of the creation time of a file. So, 
it will not work to have a program on Linux ask a file how 
long it's been since the file was created. If you want that 
information, you'll have to store it elsewhere somehow (and 
that generally only works if you created the file in the 
first place).


The modification time of the file is the time that the file 
was last changed (which would be the creation time if it were 
only ever written to once, but in the general case, it has no 
relation to the creation time at all). So, you could use 
std.file.timeLastModified to find out if a file has been 
changed within the last x number of days, but there is no way 
to find out the creation time of a file by asking the 
filesystem.


- Jonathan M Davis


Hi Jonathan,

  Thank you,  i got your point from the other forum topic 
which was raised by me earlier, hence decided to use 
modification time, the request is on how and the best approach 
to port the code from windows to Linux eg program below


Example Code:
import std.stdio: writeln;
import std.container.array;
import std.file: dirEntries,isFile, SpanMode;
import std.algorithm: filter, map;
import std.typecons: Tuple, tuple;
import std.datetime.systime: SysTime;


version (Windows) { alias sTimeStamp = timeCreated; } else 
version (linux) { alias sTimeStamp = timeLastAccessed; }


auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
 dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a 
=> a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));

 return dFiles;
}

void main () {
string LogDir;
LogDir = "//DScript/Test";   //  Error: undefined 
identifier timeLastAccessed on Linux
LogDir = "C:\\DScript\\Others";  //  Error: undefined 
identifier timeCreated on Windows.

writeln(clogClean(LogDir));
}

From,
Vino.B


Unlike NTFS for Windows there's a plethora of different file 
systems available to use for Linux, one of which doesn't even 
support deletion of files. You also have to keep in mind that 
even if the same file system is used, there is no guarantee 
that you have the same set of metadata available for a mount 
point each and every time.
Consider a file system that's mounted with the 'noatime' 
option, for instance, which doesn't log access times.


As far as I understand you are globing files, check times and 
then act upon that.
If I were to port this to Linux, or any other OS for that 
matter, I wouldn't depend on a feature of an OS.
Instead, since you have to look at a file either way to get the 
meta data (which you query with the stat family of functions), 
I would build my own database or cache with that information.
Glob the directory and add files not yet present with the 
current date (and any other meta data you might need).
Then query all the files of interest and do whatever you want 
to do with them and remove the entry.


Downside is you have possibly another dependency. On the plus 
side you could easily query all files older than X days or 
whatever with a single select and batch process them.


Hi Wjoe,

  Thank you very much, but what i am expecting is something like 
OS switch, based of OS type switch the funciton eg:


If OS is windows use the funciton timeCreated else if the OS is 
linux use the function timeLastAccessed in the below example 
program, something similar as stated in the link


https://dlang.org/spec/declaration.html#alias

Eg1:
version (Win32)
{
alias myfoo = win32.foo;
}
version (linux)
{
alias myfoo = linux.bar;
}



auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;


version (Windows) {  alias sTimeStamp = 
std.file.DirEntry.timeCreated;} else version (linux) { alias 
sTimeStamp = std.file.DirEntry.timeLastAccessed; }



dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => 
a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));

 return dFiles;
}

From,
Vino.B


Re: D as a college language

2018-05-04 Thread rikki cattermole via Digitalmars-d

On 05/05/2018 3:14 AM, bachmeier wrote:

On Friday, 4 May 2018 at 12:00:43 UTC, Sjoerd Nijboer wrote:
Instead it would offer teachers who are looking for new new teaching 
material some material that is closely coupled to other material with 
a small set of technologies. Thus not forcing students to learn a new 
language every other course. I hope that that would invite teachers to 
use D as a language for learning.


This is key. I don't know how much adoption there would be, but free, 
professional-quality teaching materials would make it much easier to adopt.


One way that I could see D getting its foot in the door is an intro 
course using Java or Python but where the instructor wants to devote a 
couple of lectures to low-level programming using pointers. D would be 
perfect for that due to the convenient syntax. Other topics like 
metaprogramming or memory management would also be reasons to use D.


I don't think the lack of industry usage is anywhere close to the 
problem posed by lack of teaching materials and instructor knowledge. 
After all, Scheme was widely used for decades, and in some places is 
still is.


Teaching materials is easy to create.
My response is the response I got from my institution.
It is industry usage which is the problem.

Nobody wants to take the risk without being able to point and say "they" 
are using it for some serious work.


[Issue 18826] [inline asm] Wrongcode for mov

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18826

--- Comment #1 from Stefan Koch  ---
More Info: 
DMD currently generates 64 48 8b 05 00 00 00 00 00 movrax,QWORD PTR
fs:[rip+0x0]

But it should generate  64 48 8b 04 25 00 00 00 00 movrax,QWORD PTR fs:0x0

--


Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn

On Friday, 4 May 2018 at 14:55:18 UTC, Timoses wrote:

On Friday, 4 May 2018 at 13:27:03 UTC, NewUser wrote:

Hi Timoses,

The structure is being returned from c and I'd like use it 
from d.


What you have work perfectly when assigning from d.


Regards,
NewUser


Then you probably need some `extern(C)` statement introducing 
the C function and the struct type, right?


You could also try dstep to "translate" the C header file to D:
https://github.com/jacob-carlborg/dstep


Hi Timoses,

Thanks for the suggestion, i'll try it out.

Regards,
NewUser


Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread wjoe via Digitalmars-d-learn

On Friday, 4 May 2018 at 14:24:36 UTC, Vino wrote:

On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote:
On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn 
wrote:

On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote:
> What are you actually trying to do with it? These functions 
> are probably the wholly wrong approach.


Hi Adam,

  The existing program in Windows do few task's eg: Delete 
files
older that certain days, and now we are trying to port to 
Linux,
and above was just a example, hence asked the right approach 
for

porting.


Linux does not keep track of the creation time of a file. So, 
it will not work to have a program on Linux ask a file how 
long it's been since the file was created. If you want that 
information, you'll have to store it elsewhere somehow (and 
that generally only works if you created the file in the first 
place).


The modification time of the file is the time that the file 
was last changed (which would be the creation time if it were 
only ever written to once, but in the general case, it has no 
relation to the creation time at all). So, you could use 
std.file.timeLastModified to find out if a file has been 
changed within the last x number of days, but there is no way 
to find out the creation time of a file by asking the 
filesystem.


- Jonathan M Davis


Hi Jonathan,

  Thank you,  i got your point from the other forum topic which 
was raised by me earlier, hence decided to use modification 
time, the request is on how and the best approach to port the 
code from windows to Linux eg program below


Example Code:
import std.stdio: writeln;
import std.container.array;
import std.file: dirEntries,isFile, SpanMode;
import std.algorithm: filter, map;
import std.typecons: Tuple, tuple;
import std.datetime.systime: SysTime;


version (Windows) { alias sTimeStamp = timeCreated; } else 
version (linux) { alias sTimeStamp = timeLastAccessed; }


auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
 dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a 
=> a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));

 return dFiles;
}

void main () {
string LogDir;
LogDir = "//DScript/Test";   //  Error: undefined 
identifier timeLastAccessed on Linux
LogDir = "C:\\DScript\\Others";  //  Error: undefined 
identifier timeCreated on Windows.

writeln(clogClean(LogDir));
}

From,
Vino.B


Unlike NTFS for Windows there's a plethora of different file 
systems available to use for Linux, one of which doesn't even 
support deletion of files. You also have to keep in mind that 
even if the same file system is used, there is no guarantee that 
you have the same set of metadata available for a mount point 
each and every time.
Consider a file system that's mounted with the 'noatime' option, 
for instance, which doesn't log access times.


As far as I understand you are globing files, check times and 
then act upon that.
If I were to port this to Linux, or any other OS for that matter, 
I wouldn't depend on a feature of an OS.
Instead, since you have to look at a file either way to get the 
meta data (which you query with the stat family of functions), I 
would build my own database or cache with that information.
Glob the directory and add files not yet present with the current 
date (and any other meta data you might need).
Then query all the files of interest and do whatever you want to 
do with them and remove the entry.


Downside is you have possibly another dependency. On the plus 
side you could easily query all files older than X days or 
whatever with a single select and batch process them.




[Issue 18827] scope delegate literal allocates GC closure

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18827

Shachar Shemesh  changed:

   What|Removed |Added

 CC||shac...@weka.io

--


Re: D as a college language

2018-05-04 Thread bachmeier via Digitalmars-d

On Friday, 4 May 2018 at 12:00:43 UTC, Sjoerd Nijboer wrote:
Instead it would offer teachers who are looking for new new 
teaching material some material that is closely coupled to 
other material with a small set of technologies. Thus not 
forcing students to learn a new language every other course. I 
hope that that would invite teachers to use D as a language for 
learning.


This is key. I don't know how much adoption there would be, but 
free, professional-quality teaching materials would make it much 
easier to adopt.


One way that I could see D getting its foot in the door is an 
intro course using Java or Python but where the instructor wants 
to devote a couple of lectures to low-level programming using 
pointers. D would be perfect for that due to the convenient 
syntax. Other topics like metaprogramming or memory management 
would also be reasons to use D.


I don't think the lack of industry usage is anywhere close to the 
problem posed by lack of teaching materials and instructor 
knowledge. After all, Scheme was widely used for decades, and in 
some places is still is.


Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread Timoses via Digitalmars-d-learn

On Friday, 4 May 2018 at 13:27:03 UTC, NewUser wrote:

Hi Timoses,

The structure is being returned from c and I'd like use it from 
d.


What you have work perfectly when assigning from d.


Regards,
NewUser


Then you probably need some `extern(C)` statement introducing the 
C function and the struct type, right?


You could also try dstep to "translate" the C header file to D:
https://github.com/jacob-carlborg/dstep


[Issue 18827] New: scope delegate literal allocates GC closure

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18827

  Issue ID: 18827
   Summary: scope delegate literal allocates GC closure
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: c...@dawg.eu

cat > bug.d << CODE
int func(int delegate(int) dg)
{
return dg(2);
}

int templ(alias dg)()
{
return dg(2);
}

void bar()
{
int a = 3;
scope dg = (int x) => x * a;
func(dg); // does not allocate closure, GOOD
templ!((int x) scope => x * a)(); // does not allocate closure, GOOD
func((int x) scope => x * a); // does allocate closure, BAD
}
CODE

Passing a delegate literal with scoped context should never allocate a closure,
but it does when the delegate is being passed by value.

With DIP1000 escaping of the context within the delegate should be statically
forbidden, right now it depends on programming correctness. Still an explicit
scope should disable allocations anyhow, though prolly mark the delegates as
unsafe.

--


Re: LDC phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

2018-05-04 Thread kinke via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:47:40 UTC, IntegratedDimensions 
wrote:

Maybe this is a cross compilation issue?


Looks like you simply didn't download the LDC multilib package.


Re: C++ / Wrong function signature generated for reference parameter

2018-05-04 Thread Timoses via Digitalmars-d-learn

On Thursday, 3 May 2018 at 11:29:59 UTC, Robert M. Münch wrote:

Not sure I understand this too. This is now what I get:

DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class 
b2d::Image & __ptr64,class b2d::Context2D::InitParams const * 
__ptr64 const) __ptr64
LIB: public: unsigned int __cdecl b2d::Context2D::_begin(class 
b2d::Image & __ptr64,class b2d::Context2D::InitParams const * 
__ptr64) __ptr64


So I somehow get some more const from D. This is the code I 
used:


   final uint _begin(ref Image image, const(InitParams) 
initParams);


Any idea how to solve this?

I really like that I'm able to use C++ stuff from D but 
interfacing the tow is a bit tedious... it would be great to be 
able to write the C++ signature in the extern(C++) scope and 
have it translated to the D equivalent internally.


Just as a note:
Related (if not to say duplicate) topic: 
https://forum.dlang.org/post/pch39e$nt7$1...@digitalmars.com


Re: Coding Challenges at Dconf2018: Implement Needleman–Wunsch and Smith–Waterman algorithms

2018-05-04 Thread biocyberman via Digitalmars-d-learn

On Friday, 4 May 2018 at 14:13:19 UTC, Luís Marques wrote:

On Monday, 30 April 2018 at 18:47:21 UTC, biocyberman wrote:
I am attending Dconf 2018 and giving a talk there on May 4. 
Link: https://dconf.org/2018/talks/le.html. It will be very 
interesting to talk about the outcome of the following 
challenges. If we can't have at least 3 solutions by three 
individuals by 10:00 GMT+2 May 4, I will have to postpone the 
deadline one week. Please see below for more details.


Too bad this didn't go on announce. I'm looking forward to it. 
I'll try to send my solution if this is postponed.


Hi Louis,
I will wait :)



Re: std.regex horribly broken in 2.080?

2018-05-04 Thread Dmitry Olshansky via Digitalmars-d

On Friday, 4 May 2018 at 11:39:18 UTC, WebFreak wrote:
I am currently working on workspace-d/serve-d but I am 
continously running into segfaults with std.regex ctRegex with 
the captures in dub and dscanner. I can't provide any other 
information really because my internet is dead right now. This 
issue is happening all the time there, yet I can't reproduce 
it. Can someone with internet maybe check where that issue 
might come from?


I could take a look. Any chance to have the exact reproduction 
steps?


By the look of it something is wrong with Captures struct being 
destroyed twice or something. Could also be compiler issue.


Another thing is to disable inlining and I could at least see 
detailed stack trace.




[...]




Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn

On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote:
On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn 
wrote:

On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote:
> What are you actually trying to do with it? These functions 
> are probably the wholly wrong approach.


Hi Adam,

  The existing program in Windows do few task's eg: Delete 
files
older that certain days, and now we are trying to port to 
Linux,
and above was just a example, hence asked the right approach 
for

porting.


Linux does not keep track of the creation time of a file. So, 
it will not work to have a program on Linux ask a file how long 
it's been since the file was created. If you want that 
information, you'll have to store it elsewhere somehow (and 
that generally only works if you created the file in the first 
place).


The modification time of the file is the time that the file was 
last changed (which would be the creation time if it were only 
ever written to once, but in the general case, it has no 
relation to the creation time at all). So, you could use 
std.file.timeLastModified to find out if a file has been 
changed within the last x number of days, but there is no way 
to find out the creation time of a file by asking the 
filesystem.


- Jonathan M Davis


Hi Jonathan,

  Thank you,  i got your point from the other forum topic which 
was raised by me earlier, hence decided to use modification time, 
the request is on how and the best approach to port the code from 
windows to Linux eg program below


Example Code:
import std.stdio: writeln;
import std.container.array;
import std.file: dirEntries,isFile, SpanMode;
import std.algorithm: filter, map;
import std.typecons: Tuple, tuple;
import std.datetime.systime: SysTime;


version (Windows) { alias sTimeStamp = timeCreated; } else 
version (linux) { alias sTimeStamp = timeLastAccessed; }


auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
 dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => 
a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));

 return dFiles;
}

void main () {
string LogDir;
LogDir = "//DScript/Test";   //  Error: undefined identifier 
timeLastAccessed on Linux
LogDir = "C:\\DScript\\Others";  //  Error: undefined identifier 
timeCreated on Windows.

writeln(clogClean(LogDir));
}

From,
Vino.B


Re: Coding Challenges at Dconf2018: Implement Needleman–Wunsch and Smith–Waterman algorithms

2018-05-04 Thread Luís Marques via Digitalmars-d-learn

On Monday, 30 April 2018 at 18:47:21 UTC, biocyberman wrote:
I am attending Dconf 2018 and giving a talk there on May 4. 
Link: https://dconf.org/2018/talks/le.html. It will be very 
interesting to talk about the outcome of the following 
challenges. If we can't have at least 3 solutions by three 
individuals by 10:00 GMT+2 May 4, I will have to postpone the 
deadline one week. Please see below for more details.


Too bad this didn't go on announce. I'm looking forward to it. 
I'll try to send my solution if this is postponed.


[Issue 18826] New: [inline asm] Wrongcode for mov

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18826

  Issue ID: 18826
   Summary: [inline asm] Wrongcode for mov
   Product: D
   Version: D2
  Hardware: x86_64
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: uplink.co...@gmail.com

the following code does get mis-compiled. 
ulong getThreadID()
{
asm { naked; mov RAX, qword ptr FS:0x0 }
}

--


Re: DUB registry is now Boost licensed

2018-05-04 Thread bachmeier via Digitalmars-d-announce

On Friday, 4 May 2018 at 13:35:32 UTC, Seb wrote:

You can now modify it without needing to publish all your 
patches which the GPL license before required.


Just to clarify, given all the misinformation floating around 
about licenses, the GPL contains no such requirement. You are 
only required to make the source of a derived work available to 
recipients of that derived work. It's unlikely that anyone was 
ever distributing modified versions of the dub registry but 
wanted to keep their source code secret from the recipients.


Re: LDC phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

2018-05-04 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:47:40 UTC, IntegratedDimensions 
wrote:
trying to compile a simple program in x86. Compiles fine in dmd 
and ldcx64.


Seems like ldc is using the wrong lib for some reason?


phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine 
type 'x64' conflicts with target machine type 'x86'


To help, we need more details, such as what code are you 
compiling, what version of LDC, and what commandline.


- Johan



Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn wrote:
> On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote:
> > What are you actually trying to do with it? These functions are
> > probably the wholly wrong approach.
>
> Hi Adam,
>
>   The existing program in Windows do few task's eg: Delete files
> older that certain days, and now we are trying to port to Linux,
> and above was just a example, hence asked the right approach for
> porting.

Linux does not keep track of the creation time of a file. So, it will not
work to have a program on Linux ask a file how long it's been since the file
was created. If you want that information, you'll have to store it elsewhere
somehow (and that generally only works if you created the file in the first
place).

The modification time of the file is the time that the file was last changed
(which would be the creation time if it were only ever written to once, but
in the general case, it has no relation to the creation time at all). So,
you could use std.file.timeLastModified to find out if a file has been
changed within the last x number of days, but there is no way to find out
the creation time of a file by asking the filesystem.

- Jonathan M Davis



Re: std.regex horribly broken in 2.080?

2018-05-04 Thread Seb via Digitalmars-d

On Friday, 4 May 2018 at 11:39:18 UTC, WebFreak wrote:
I am currently working on workspace-d/serve-d but I am 
continously running into segfaults with std.regex ctRegex with 
the captures in dub and dscanner. I can't provide any other 
information really because my internet is dead right now. This 
issue is happening all the time there, yet I can't reproduce 
it. Can someone with internet maybe check where that issue 
might come from?


[...]


FWIW ctRegex might be deprecated soon: 
https://github.com/dlang/phobos/pull/6164


Does the normal regex work?


Re: How do you connect Python with D via socket, I'm still getting connection refused error

2018-05-04 Thread Andy Smith via Digitalmars-d-learn

On Thursday, 3 May 2018 at 23:58:24 UTC, Enjoys Math wrote:

Error
-

[...]



Haven't run it, but two things to try...

On D side try adding listen after bind.

On python side. Don't think you need to call bind the client 
socket ( this may cause problems).


Cheers,

A.





DUB registry is now Boost licensed

2018-05-04 Thread Seb via Digitalmars-d-announce
Just a quick heads-up at all those people how were considering of 
rolling a customized dub in-house (or on your favorite PaaS 
provider).
You can now modify it without needing to publish all your patches 
which the GPL license before required.
Of course, improvement patches (aka PRs) are still very welcome 
;-)


See also:

https://github.com/dlang/dub-registry/pull/272


Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn

On Friday, 4 May 2018 at 13:21:53 UTC, Timoses wrote:

On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:
tried defining items[] as both "Item[] items" and "Item* 
items" in d, it compiles okay but gives an error when trying 
to access it.


You were on the right track. D array notation is:

[] ;

For me this works:

```
struct Item
{
  int id;
};

struct Group
{
  int i;
  int item_count;
  Item[] items;
};

void main()
{
auto g = Group();
g.items ~= Item(3);
assert(g.items[0].id == 3);
}
```


Hi Timoses,

The structure is being returned from c and I'd like use it from d.

What you have work perfectly when assigning from d.


Regards,
NewUser



Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread Timoses via Digitalmars-d-learn

On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:
tried defining items[] as both "Item[] items" and "Item* items" 
in d, it compiles okay but gives an error when trying to access 
it.


You were on the right track. D array notation is:

[] ;

For me this works:

```
struct Item
{
  int id;
};

struct Group
{
  int i;
  int item_count;
  Item[] items;
};

void main()
{
auto g = Group();
g.items ~= Item(3);
assert(g.items[0].id == 3);
}
```


Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread Simen Kjærås via Digitalmars-d-learn

On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:

How can I use the following c structure from d.

struct Item
{
  int id;
};

struct Group
{
  int i;
  int item_count;
  struct Item items[];
};

tried defining items[] as both "Item[] items" and "Item* items" 
in d, it compiles okay but gives an error when trying to access 
it.


Here is the error.
object.Error@(0): Access Violation


The D equivalent is:

struct Item {
int id;
}

struct Group {
int i;
int item_count;
Item* items;
}

The error message you're getting makes me think items is null. 
The lack of function names in the stack trace makes it kinda hard 
to understand exactly what's happening - you can turn that on 
with -g for DMD. Seeing some of the code that uses these structs 
might also help.


--
  Simen


Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn

On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote:
What are you actually trying to do with it? These functions are 
probably the wholly wrong approach.


Hi Adam,

 The existing program in Windows do few task's eg: Delete files 
older that certain days, and now we are trying to port to Linux, 
and above was just a example, hence asked the right approach for 
porting.




From,
Vino.B



using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn

Hi,

How can I use the following c structure from d.

struct Item
{
  int id;
};

struct Group
{
  int i;
  int item_count;
  struct Item items[];
};

tried defining items[] as both "Item[] items" and "Item* items" 
in d, it compiles okay but gives an error when trying to access 
it.


Here is the error.
object.Error@(0): Access Violation

0x00BCA9D1
0x00BC104C
0x00BD01EB
0x00BD0169
0x00BD
0x00BCA827
0x74118654 in BaseThreadInitThunk
0x77534B17 in RtlGetAppContainerNamedObjectPath
0x77534AE7 in RtlGetAppContainerNamedObjectPath


Regards,
NewUser




Re: Windows to Linux Porting

2018-05-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 04, 2018 10:25:28 Russel Winder via Digitalmars-d-learn 
wrote:
> On Fri, 2018-05-04 at 08:47 +, Vino via Digitalmars-d-learn wrote:
>
> […]
>
> >   Was able to resolve the issue, the issue was the letter "L" in
> >
> > version (Linux) where is should be version (linux).
>
> It would have helped if I had read the code first rather than jumped to a
> conclusion.
>
> :-)

It happens to us all from time to time, and the casing of the version
identifiers can be easy to screw up and easy to miss the mistakes -
especially since many of them are based on the names that get used with
#ifdef in C/C++ rather than having consistent casing across the various
version identifiers.

- Jonathan M Davis




Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Adam D. Ruppe via Digitalmars-d-learn
What are you actually trying to do with it? These functions are 
probably the wholly wrong approach.


Re: D as a college language

2018-05-04 Thread Sjoerd Nijboer via Digitalmars-d

On Friday, 4 May 2018 at 11:37:58 UTC, rikki cattermole wrote:
First we need adoption, then maybe we can start designing a 
course to help get them going.


Even with adoption, I think the exposure of D and its 
capabilities to teachers is too small for them to notice unless 
it is exposed to them as a new learning strategy for their 
students. After all, teaching is a difficult and time consuming 
skill and in my personal experience consumes almost all of the 
time a teacher has. Leaving very little time over for a teacher 
to explore new technologies such as D and design new courses 
around them. No teacher I know knows of the existence of D. And 
when I tell them they assume it is not important to learning 
computer science.


Therefore I was thinking something more along the lines of a set 
of free open source courses which use D to learn certain aspects 
programming and programming related subjects. That would most 
likely not draw in a lot of new programmers who start programming 
on their own. They tend to stick to the popular languages. 
Instead it would offer teachers who are looking for new new 
teaching material some material that is closely coupled to other 
material with a small set of technologies. Thus not forcing 
students to learn a new language every other course. I hope that 
that would invite teachers to use D as a language for learning.


On Friday, 4 May 2018 at 11:52:36 UTC, bauss wrote:
To the one hiring the person with 7 years of experience seem 
like a better choice, just because they generally have no idea 
what D is and what it offers. They don't know that if you 
program in D you can usually program very well, if not better 
than most general Java developers __when__ using Java. All they 
know is that they use Java and they're looking for the one with 
most experience in that field.


Until D becomes an industrial requirement, then it will not be 
taught.


That's why D is a hobby language.


Unfortunately true.
It just seems like a missed opportunity.


Re: D as a college language

2018-05-04 Thread bauss via Digitalmars-d

On Friday, 4 May 2018 at 11:35:22 UTC, Sjoerd Nijboer wrote:
So i'm a college student in and what bothers me is that there 
seem to kind of assume programming languages don't evolve or 
don't get replaced by better ones.
Right now if you go to college you'll most likely get tought 
c++, c# or java for any comp sci degree. While these languages 
are industrial standards, they all have their drawbacks. And 
one drawback that looks important for teaching is flexibility 
in expressiveness.


From my experience college students seem to have problems 
translating their often declarative thought process into actual 
semi compile-able code that runs in a given language.
Since D seems to be a language that supports a lot of 
programming paradigms very well, wouldn't it be beneficial to 
learn people declarative programming using D for a little and 
from there expose them to other programming styles in thesame 
language to lower the barrier of entry?


I think D could play a bigger role in education since its such 
a "clean" language that is flexible but doesn't have any real 
gotcha "features". Its also a language that could potentially 
be used over someones entire college career as the primary 
language. If this would be achieved there would be a higher 
income flow into the industry of young D programmers which will 
pollute other programmers with the D mind and featureset.


The biggest issue is that there isn't much industrial work done 
in D and that's why it's not taught.


When you're taught to program in specific languages, it's because 
those languages are where the job market is at.


I completely agree with your post however, but I don't see D ever 
taking off as an educational programming language in the majority 
of schools, because it doesn't have a job market to support it.


Say if you apply for a Java job and it says you have 10 years of 
experience programming in D and 3 years of experience programming 
Java, then another applicant has 7 years of experience 
programming in Java, but 0 experience with programming in D.


To the one hiring the person with 7 years of experience seem like 
a better choice, just because they generally have no idea what D 
is and what it offers. They don't know that if you program in D 
you can usually program very well, if not better than most 
general Java developers __when__ using Java. All they know is 
that they use Java and they're looking for the one with most 
experience in that field.


Until D becomes an industrial requirement, then it will not be 
taught.


That's why D is a hobby language.


Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn

Hi All,

  Request your help, I have a D program written on Windows 
platform and the program is working as expected, now i am trying 
to port the same program to Linux, my program use the function 
"timeCreated" from std.file for Windows hugely where as in Linux 
we do not have the same function hence planned to use the 
function "timeLastAccessed" from std.file, so what is the best 
approach to port the program. I tried the below code but not 
working, so can you one please guide me on the right method to 
port the program to linux, below is the example code.


Example Code:
import std.stdio: writeln;
import std.container.array;
import std.file: dirEntries,isFile, SpanMode;
import std.algorithm: filter, map;
import std.typecons: Tuple, tuple;
import std.datetime.systime: SysTime;


version (Windows) { alias sTimeStamp = timeCreated; } else 
version (linux) { alias sTimeStamp = timeLastAccessed; }


auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
 dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => 
a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));

 return dFiles;
}

void main () {
string LogDir;
LogDir = "//DScript/Test";   //  Error: undefined identifier 
timeLastAccessed on Linux
LogDir = "C:\\DScript\\Others";  //  Error: undefined identifier 
timeCreated on Windows.

writeln(clogClean(LogDir));
}

From,
Vino.B




[Issue 18825] New: No syntax for function literal returning a reference

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18825

  Issue ID: 18825
   Summary: No syntax for function literal returning a reference
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: j...@leroy.nyc

Consider:

int global;

int foo()
{
  return global;
}

As per the doc, this is equivalent to:

auto foo = function int() {
  return global;
};

But it is not possible to create a function literal equivalent to this:

ref int foo()
{
  return global;
}

I tried placing the ref everywhere it makes sense, to no avail.

--


Re: Windows to Linux Porting

2018-05-04 Thread Vino via Digitalmars-d-learn

On Friday, 4 May 2018 at 09:25:28 UTC, Russel Winder wrote:
On Fri, 2018-05-04 at 08:47 +, Vino via Digitalmars-d-learn 
wrote:



[…]
  Was able to resolve the issue, the issue was the letter "L" 
in

version (Linux) where is should be version (linux).


It would have helped if I had read the code first rather than 
jumped to a conclusion.


:-)


Hi Russel,
 No issue, and thank you for your help.

From,
Vino.B




D as a college language

2018-05-04 Thread Sjoerd Nijboer via Digitalmars-d
So i'm a college student in and what bothers me is that there 
seem to kind of assume programming languages don't evolve or 
don't get replaced by better ones.
Right now if you go to college you'll most likely get tought c++, 
c# or java for any comp sci degree. While these languages are 
industrial standards, they all have their drawbacks. And one 
drawback that looks important for teaching is flexibility in 
expressiveness.


From my experience college students seem to have problems 
translating their often declarative thought process into actual 
semi compile-able code that runs in a given language.
Since D seems to be a language that supports a lot of programming 
paradigms very well, wouldn't it be beneficial to learn people 
declarative programming using D for a little and from there 
expose them to other programming styles in thesame language to 
lower the barrier of entry?


I think D could play a bigger role in education since its such a 
"clean" language that is flexible but doesn't have any real 
gotcha "features". Its also a language that could potentially be 
used over someones entire college career as the primary language. 
If this would be achieved there would be a higher income flow 
into the industry of young D programmers which will pollute other 
programmers with the D mind and featureset.


std.regex horribly broken in 2.080?

2018-05-04 Thread WebFreak via Digitalmars-d
I am currently working on workspace-d/serve-d but I am 
continously running into segfaults with std.regex ctRegex with 
the captures in dub and dscanner. I can't provide any other 
information really because my internet is dead right now. This 
issue is happening all the time there, yet I can't reproduce it. 
Can someone with internet maybe check where that issue might come 
from?


[Switching to Thread 0x7f3db0ba7700 (LWP 14593)]
0x55f92a385dd3 in 
_D3std5regex__T10matchFirstTAyaTSQBfQBe__T11ctRegexImplVQBca7_5e5c647b352c7dVQBxA0Z7WrapperZQCzFNfQCsQCrZSQEaQDz__T8CapturesTQDtZQo (__HID720=0x7f3d0001, re=...,

input=...) at /usr/include/dlang/dmd/std/regex/package.d:980
980 import std.algorithm.iteration : map;
(gdb) bt
#0  0x55f92a385dd3 in 
_D3std5regex__T10matchFirstTAyaTSQBfQBe__T11ctRegexImplVQBca7_5e5c647b352c7dVQBxA0Z7WrapperZQCzFNfQCsQCrZSQEaQDz__T8CapturesTQDtZQo (__HID720=0x7f3d0001,
re=..., input=...) at 
/usr/include/dlang/dmd/std/regex/package.d:980
#1  0x55f92a37e459 in 
_D8analysis7numbers16NumberStyleCheck5visitMFxS3std12experimental5lexer__T14TokenStructureThVAyaa305_0a20202020737472696e6720636f6d6d656e743b0a20202020737472696e6720747261696c696e67436f6d6d656e743b0a0a20202020696e74206f70436d702873697a655f7420692920636f6e73742070757265206e6f7468726f77204073616665207b0a202020202020202069662028696e646578203c2069292072657475726e202d313b0a202020202020202069662028696e646578203e2069292072657475726e20313b0a202020202020202072657475726e20303b0a202020207d0a0a20202020696e74206f70436d702872656620636f6e737420747970656f66287468697329206f746865722920636f6e73742070757265206e6f7468726f77204073616665207b0a202020202020202072657475726e206f70436d70286f746865722e696e646578293b0a202020207d0aZQYoZv (
this=0x7f3db3002100, t=...) at 
../../.dub/packages/dscanner-0.4.2/dscanner/src/analysis/numbers.d:38
#2  0x55f92a41278f in 
_D6dparse3ast17PrimaryExpression6acceptMxFCQBpQBl10ASTVisitorZv 
(this=0x7f3da805bde8, visitor=0x7f3db3002100)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d-mixin-2503:2506
#3  0x55f92a40585d in 
_D6dparse3ast10ASTVisitor5visitMFxCQBhQBd17PrimaryExpressionZv 
(this=0x7f3db3002100, primaryExpression=0x7f3da805bde8)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d:279
#4  0x55f92a416afd in 
_D6dparse3ast15UnaryExpression6acceptMxFCQBnQBj10ASTVisitorZv 
(this=0x7f3da805bcd8, visitor=0x7f3db3002100)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d-mixin-3252:3252
#5  0x55f92a405eed in 
_D6dparse3ast10ASTVisitor5visitMFxCQBhQBd15UnaryExpressionZv 
(this=0x7f3db3002100, unaryExpression=0x7f3da805bcd8)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d:332
#6  0x55f92a4046e3 in 
_D6dparse3ast10ASTVisitor5visitMFxCQBhQBd14ExpressionNodeZv 
(this=0x7f3db3002100, n=0x7f3da805bcd8)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d:137
#7  0x55f92a408800 in 
_D6dparse3ast16AssignExpression6acceptMxFCQBoQBk10ASTVisitorZv 
(this=0x7f3da805bc98, visitor=0x7f3db3002100)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d-mixin-867:868
#8  0x55f92a404b5d in 
_D6dparse3ast10ASTVisitor5visitMFxCQBhQBd16AssignExpressionZv 
(this=0x7f3db3002100, assignExpression=0x7f3da805bc98)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d:175
#9  0x55f92a404298 in 
_D6dparse3ast10ASTVisitor5visitMFxCQBhQBd14ExpressionNodeZv 
(this=0x7f3db3002100, n=0x7f3da805bc98)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d:108
#10 0x55f92a40d0ee in 
_D6dparse3ast10Expression6acceptMxFCQBiQBe10ASTVisitorZv 
(this=0x7f3da805b798, visitor=0x7f3db3002100)
at 
../../.dub/packages/libdparse-0.7.2-alpha.6/libdparse/src/dparse/ast.d-mixin-1575:1575
#11 0x55f92a4050bd in 
_D6dparse3ast10ASTVisitor5visitMFxCQBhQBd10ExpressionZv 
(this=0x7f3db3002100, expression=0x7f3da805b798)




Re: D as a college language

2018-05-04 Thread rikki cattermole via Digitalmars-d

On 04/05/2018 11:35 PM, Sjoerd Nijboer wrote:
So i'm a college student in and what bothers me is that there seem to 
kind of assume programming languages don't evolve or don't get replaced 
by better ones.
Right now if you go to college you'll most likely get tought c++, c# or 
java for any comp sci degree. While these languages are industrial 
standards, they all have their drawbacks. And one drawback that looks 
important for teaching is flexibility in expressiveness.


 From my experience college students seem to have problems translating 
their often declarative thought process into actual semi compile-able 
code that runs in a given language.
Since D seems to be a language that supports a lot of programming 
paradigms very well, wouldn't it be beneficial to learn people 
declarative programming using D for a little and from there expose them 
to other programming styles in thesame language to lower the barrier of 
entry?


I made this very argument during my own degree.

First we need adoption, then maybe we can start designing a course to 
help get them going.




could someone test support for Asian languages in nanogui port?

2018-05-04 Thread drug via Digitalmars-d-learn
I port nanogui, but besides porting I'd like to improve it using great 
capabilities of D language provides. One of them is utf support, so I 
added support for Asian languages to nanogui.TextBox. But I'm not sure 
I've did it well and so I'd like to ask someone to test it using the 
following:

```
git clone --recursive https://github.com/drug007/nanogui.git
cd nanogui
git checkout textbox # TextBox exists in this branch only
dub --config=sdl # Keyboard events provided only by SDL2 backend only
```

On the right side there will be a window with four text boxes with 
russian, english, japanese and chinese text respectively. It would be 
nice to get some feedback from users - probably I did something totally 
wrong. Also I'm curious does it worth efforts?


[Issue 11372] getpagesize() should be in core.memory

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11372

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #3 from Steven Schveighoffer  ---
(In reply to Dmitry Olshansky from comment #2)
> Anyway I guess the point is that collector need to know page size anyway,
> and there is a global hidden somewhere deep that holds this size.

Was about to add an issue to suggest we expose this immutable. It's here:

https://github.com/dlang/druntime/blob/86cd40a036a67d9b1bff6c14e91cba1e5557b119/src/core/thread.d#L3619

Can I make a pull to provide access to this somewhere public? Alternatively, we
could just make the immutable public.

--


[Issue 18824] New: [REG 2.080]

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18824

  Issue ID: 18824
   Summary: [REG 2.080]
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: the.mail.of@gmail.com

This code fails to compile:

import std.stdio;
import std.typecons;

alias Type = Tuple!(int, string);
void main()
{
Type[] arr;
arr = arr ~ tuple(2, "s");
writeln(arr);
}

Message:
onlineapp.d(8): Error: cannot implicitly convert expression tuple(2,
"s").opBinaryRight(arr) of type Tuple!(Tuple!(int, string)[], int, string) to
Tuple!(int, string)[]

I can't see anything in changelog that could be related to this, thus I expect
it's a regression.

--


[Issue 18824] [REG 2.080] Tuple's opBinaryRight takes precedence over appending a tuple to an array of tuples

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18824

Mitu  changed:

   What|Removed |Added

Summary|[REG 2.080] |[REG 2.080] Tuple's
   ||opBinaryRight takes
   ||precedence over appending a
   ||tuple to an array of tuples

--


[Issue 18823] New: null is not shared as far as templates go

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18823

  Issue ID: 18823
   Summary: null is not shared as far as templates go
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dmitry.o...@gmail.com

Tested on DMD 2.079.

void main(){
// failure: template testme.takePointer cannot deduce function from
argument types 
//!()(typeof(null)), candidates are: ...
takePointer(null); 
takePointer2(null);
}

void takePointer(T)(shared(T)* ptr){}

void takePointer2(T)(shared T* ptr){}

// same problem in the "real" world
void inPhobos(){
import core.atomic;
shared Object abc;
shared Object b = new Object;
cas(, b, null); // doesn't compile
cas(, b, cast(shared)null); // this compiles
atomicStore(abc, null); // this compiles as well
}

--


[Issue 18818] VariantN has unittests that are compiled into user modules

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18818

Giles Bathgate  changed:

   What|Removed |Added

 CC||giles.bathgate+dlang@gmail.
   ||com

--- Comment #1 from Giles Bathgate  ---
For reference:

StdUnittest was added in this PR
https://github.com/dlang/phobos/pull/5927

StdUnittest was removed in this PR
https://github.com/dlang/phobos/pull/6202

--


Re: Should 'in' Imply 'ref' as Well for Value Types?

2018-05-04 Thread Jonathan M Davis via Digitalmars-d
On Friday, May 04, 2018 09:15:57 Vijay Nayar via Digitalmars-d wrote:
> While working on a library built for high efficiency, avoiding
> unnecessary copies of structs became an issue.  I had assumed
> that `in` was doing this, but a bit of experimentation revealed
> that it does not.  However, `ref in` works great.
>
> My question is, should `in` by default also imply `ref` for value
> types like structs?  Is there a reason not to do this?

ref only accepts lvalues and as such can be extremely annoying to use.
There's no question that it has its place, but in most cases, you don't want
it, because it makes it so that you then mostly can't chain function calls
and are forced to store all of the function results on the stack in order to
call the next function. And addition to being annoying, it's usually less
less efficient, because if you pass an rvalue to a function, then the value
is moved to the parameter, which can't be done if you store the value on the
stack. It's actually not infrequent now that in C++, you want to pass stuf
by value rather than const& precisely because move semantics can be used to
avoid copies. So, it's not at all necessarily the case that passing by ref
is the efficient thing to do. It's heavily dependent on the code in
question.

So, even if we were designing in from scratch, making ref would be a
questionable choice. However, even if we all agreed that it would be
desirable, such a change would break a large percentage of code that
currently uses in, because any code that passes an rvalue to a function
taking its argument as in would then break. So, any attempt to change in to
include ref would have to have some sort of deprecation path to avoid code
breakage. But given how annoying it would be to have in be ref by default
due to how that affects rvalues, I'm willing to bet that most programmers
would not be at all happy with such a change, regardless of how well the
transitition was handled.

- Jonathan M Davis



Re: Windows to Linux Porting

2018-05-04 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-05-04 at 08:47 +, Vino via Digitalmars-d-learn wrote:
> 
[…]
>   Was able to resolve the issue, the issue was the letter "L" in 
> version (Linux) where is should be version (linux).

It would have helped if I had read the code first rather than jumped to a
conclusion.

:-)



-- 
Russel.
==
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


signature.asc
Description: This is a digitally signed message part


Should 'in' Imply 'ref' as Well for Value Types?

2018-05-04 Thread Vijay Nayar via Digitalmars-d
While working on a library built for high efficiency, avoiding 
unnecessary copies of structs became an issue.  I had assumed 
that `in` was doing this, but a bit of experimentation revealed 
that it does not.  However, `ref in` works great.


My question is, should `in` by default also imply `ref` for value 
types like structs?  Is there a reason not to do this?


This is the test program I used for reference:

```
import std.stdio;

struct Bob {
int a;
this(this) {
  writeln("");
}
}

void main()
{
Bob b = Bob(3);
writeln(" = ", );
void showAddrIn(in Bob b) {
writeln("(showAddrIn) = ", );
}
showAddrIn(b);
void showAddrRefIn(ref in Bob b) {
writeln("(showAddrRefIn)  = ", );
}
showAddrRefIn(b);
}
```

The output is as follows:

```
 = 7FFD9F526AD0

(showAddrIn) = 7FFD9F526AB0
(showAddrRefIn)  = 7FFD9F526AD0
```


Re: auto: useful, annoying or bad practice?

2018-05-04 Thread Nick Sabalausky (Abscissa) via Digitalmars-d

On 05/04/2018 03:56 AM, Laeeth Isharc wrote:

On Friday, 4 May 2018 at 04:12:09 UTC, Nick Sabalausky (Abscissa) wrote:

On 05/02/2018 10:05 AM, H. S. Teoh wrote:

[...]


I don't doubt that. Similar to global namespace, if the structural 
typing is only used heavily by one or two components of a project (ie, 
libs, etc), then it's not too difficult to avoid problems. The real 
danger and problems come when a project uses several components that 
all make heavy use of either a global namespace (which D luckily 
doesn't really have) or structural typing.


[...]


Have you seen Atila's concepts library?


Yea, last I checked, it doesn't address what I'm talking about at all. 
That lib's basically just this:


struct Foo {...}
static assert(isXYX!Foo);

But with more detailed diagnostics. (Plus it can help you write the 
isXYZ function.)


Unless something's changed since last looked at it, it didn't address my 
#1 key point: If struct Foo's author *doesn't* include the lib's 
"@models!(Foo, isFoo)", then isFoo!Foo should return false.


[Issue 17968] [REG 2.073] object initializer omitted when it should be included.

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17968

--- Comment #4 from RazvanN  ---
Also, if IOObject is not templated, the code compiles.

--


Re: Windows to Linux Porting

2018-05-04 Thread Vino via Digitalmars-d-learn

On Friday, 4 May 2018 at 07:43:39 UTC, Russel Winder wrote:
On Fri, 2018-05-04 at 03:30 +, Vino via Digitalmars-d-learn 
wrote:

[...]


`./nasconfig.txt`

perhaps: Linux uses / (as does Windows in fact) for directory 
separator.



[...]


Hi Russel,

 Was able to resolve the issue, the issue was the letter "L" in 
version (Linux) where is should be version (linux).



From,
Vino.B


Re: Announcing Mecca

2018-05-04 Thread Laeeth Isharc via Digitalmars-d-announce

On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote:

Hello everybody,

I am very happy to announce that Mecca version 0.0.1 (sorry, no 
more zeros than that) is now officially available. You can get 
the source code at https://github.com/weka-io/mecca. The API 
documentation is at https://weka-io.github.com/mecca/docs.


[...]


https://www.reddit.com/r/programming/comments/8gxrkg/wekaio_open_sources_mecca_dlang_library_for_nogc?sort=new


Re: Windows to Linux Porting

2018-05-04 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-05-04 at 03:30 +, Vino via Digitalmars-d-learn wrote:
> Hi All,
> 
>Request you help on the below code, the below code always state 
> the file does not exist even if the file do exist.
> 
> Code:
> 
> import core.stdc.stdlib: exit;
> import std.stdio;
> import std.file;
> import std.path;
> 
> auto osSwitch () {
> string ConfigFile;
> version (Windows) { ConfigFile = absolutePath(`.\nasconfig.txt`); 

`./nasconfig.txt`

perhaps: Linux uses / (as does Windows in fact) for directory separator. 

> } else version (Linux) { ConfigFile = 
> absolutePath(`nasconfig.txt`); }
> return ConfigFile;
> }
> void main () {
> auto ConfigFile = osSwitch;
> if (!ConfigFile.exists) { writeln("The Configuration File ", 
> buildNormalizedPath(ConfigFile), " do to exist, Terminating the 
> execution.."); exit(-1);}
> else { writeln(ConfigFile); }
> }
> 
> From,
> Vino.B
> 
-- 
Russel.
==
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


signature.asc
Description: This is a digitally signed message part


eSoftTools OST to PST Converter

2018-05-04 Thread avina via Digitalmars-d
Removes errors from OST corrupted file data without facing any 
problem. this software has very usable tool it easily repair 
Outlook OST file and convert Ost file into multiple formats like 
PST, EML, MSG, HTML, vCard, MBOX, EMLX. from emails, and multiple 
emails(contacts, calendar, images, notes, attachments etc. here 
you can convert selective file formats and complete file formats. 
Here you convert demo version of the software which convert 25 
emails each folder.


get more info:- 
http://www.esofttools.com/ost-to-pst-converter.html


[Issue 17968] [REG 2.073] object initializer omitted when it should be included.

2018-05-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17968

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--


Re: auto: useful, annoying or bad practice?

2018-05-04 Thread Laeeth Isharc via Digitalmars-d
On Friday, 4 May 2018 at 04:12:09 UTC, Nick Sabalausky (Abscissa) 
wrote:

On 05/02/2018 10:05 AM, H. S. Teoh wrote:

[...]


I don't doubt that. Similar to global namespace, if the 
structural typing is only used heavily by one or two components 
of a project (ie, libs, etc), then it's not too difficult to 
avoid problems. The real danger and problems come when a 
project uses several components that all make heavy use of 
either a global namespace (which D luckily doesn't really have) 
or structural typing.


[...]


Have you seen Atila's concepts library?


Re: C++ / const class pointer signature / unable to find correct D syntax

2018-05-04 Thread Uknown via Digitalmars-d-learn

On Friday, 4 May 2018 at 07:49:02 UTC, Robert M. Münch wrote:
I have a static C++ and can't make it to get a correct binding 
for one function:


DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class 
b2d::Image & __ptr64,class b2d::Context2D::InitParams const * 
__ptr64 const) __ptr64
LIB: public: unsigned int __cdecl b2d::Context2D::_begin(class 
b2d::Image & __ptr64,class b2d::Context2D::InitParams const * 
__ptr64) __ptr64


So I somehow get some more const from D. This is the code I 
used:


   final uint _begin(ref Image image, const(InitParams) 
initParams);


Which creates a const pointer to a const class signature. But 
it should only be a const pointer. Any idea how to solve this?


The problem is that const in D is transitive. That means T * 
const from C++ is not expressible in D. Any reference through a 
const becomes const. To use it, IMO your best bet is to make a 
wrapper function on the C++ side like this:


unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & 
im,class b2d::Context2D::InitParams const * const InitParams)

{
return //the call to the original c++ function
}

Alternatively you can use dpp, or dstep or some similar tool to 
try and let the tool create bindings. As a last ditch, you can 
force the mangle to match by using pragma(mangle, ...) like this:


pragma(mangle, _ZactualMangleFromC++Compiler)
final uint _begin(ref Image image, const(InitParams) initParams);


C++ / const class pointer signature / unable to find correct D syntax

2018-05-04 Thread Robert M. Münch via Digitalmars-d-learn
I have a static C++ and can't make it to get a correct binding for one 
function:


DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class 
b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 
const) __ptr64
LIB: public: unsigned int __cdecl b2d::Context2D::_begin(class 
b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64) 
__ptr64


So I somehow get some more const from D. This is the code I used:

   final uint _begin(ref Image image, const(InitParams) initParams);

Which creates a const pointer to a const class signature. But it should 
only be a const pointer. Any idea how to solve this?


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: Tilix 1.7.9 Released

2018-05-04 Thread Martin Tschierschke via Digitalmars-d-announce

On Thursday, 3 May 2018 at 15:43:14 UTC, Marco Leise wrote:

https://linuxmint.com/
https://manjaro.org/
https://www.ubuntu.com/
https://www.debian.org/
https://solus-project.com/
https://elementary.io/
https://antergos.com/
https://getfedora.org/
https://www.trueos.org/ (FreeBSD)
https://mxlinux.org/

Cool list of projects beyond linux, thank you.




Re: Is HibernateD dead?

2018-05-04 Thread bauss via Digitalmars-d-learn

On Thursday, 3 May 2018 at 23:05:02 UTC, Matthias Klumpp wrote:

On Thursday, 3 May 2018 at 21:28:18 UTC, bauss wrote:

On Thursday, 3 May 2018 at 18:01:07 UTC, Matthias Klumpp wrote:
DiamondMVC looks nice, but I would need PostgreSQL support 
for sure.

Therefore, I think there are three options:
 1) Extend the DiamondMVC ORM to support missing features 
that Hibernated has (maybe make it use ddbc as backend?)
 2) Revive Hibernated - contacting Vadim Lopatin would be key 
for that, and maybe the project could be maintained in the 
dlang-community organization (although there are competing 
projects for it...)
 3) Find a different D ORM that does the job and expand it to 
include missing features.


Yes, I completely agree with PostgreSQL support. It's really 
important to me getting that working, as well MSSQL. I was 
hoping I could find time this weekend to actually do that.


Would it maybe be easier for you to base on ddbc[1] or another 
existing abstraction layer for database abstraction?
Ddbc is pretty neat, and even has support for reading structs 
directly from the database.




Perhaps, but it'd have to be a forked version as I don't really 
want to depend on something that isn't updated regularly.


ddbc's last commit was a year ago.

I can't seem to find a license for it though?



[1]: https://github.com/buggins/ddbc

Perhaps I will end up having another "optional" dependency to 
it as a temporary until I can have a better implementation or 
something.


The frontend part of postgresql is almost finished, it's just 
having the postgresql driver working properly, which is where 
it's frozen right now.


Hmm... Does any public code for that exist already that I could 
play around with?
Unfortunately, I have a few more unusual requirements for 
Postgres, like:

 * UUIDs as primary keys, instead of integers


As far as I remember the implementation of @DbId in Diamond, then 
it supports whatever type.


Diamond doesn't care much about what type your primary key is.

I will make sure that's how it function of course, if it 
currently doesn't behave like it, but I'm pretty sure it does.


 * Ability to register custom datatypes with the ORM (version 
numbers in this case, the ORM can view them as text, but the 
database has a special type for them)


That could be done with some attribute that lets you handle 
columns yourself.


Do you have a good name for it?

I was thinking @DbProxy and then the function would be something 
like:


@DbProxy(functionName) string field;

...

auto functionName(RawDbType type)
{
return the new datatype that matches the field with the 
@DbProxy attribute.

}

 * Obviously the usual ORM stuff, one-to-many, many-to-many, 
etc. relations




Yes, relations is one thing I haven't added and I have been 
wanting to do it for a while.


I will definitely look into having it added as well.

(Obviously not a must-have list, I added support for custom 
datatypes to my ddbc fork as well, because it's not really a 
feature many people need)




Well, that's kind of the key to most of the development in 
Diamond.


I usually add functionality that isn't widely used and in most 
cases people implement it themselves ex. the whole diamond.seo is 
not usually something a framework has.


Diamond is a neat project, I played around with it about half a 
year ago, but didn't test the ORM part at all back then.


It wasn't that good back then and has improved a lot since, as 
well many other parts of Diamond. Over the past half year it has 
grown rapidly, both in stability and functionality.


Re: mysql-native v2.2.2: Minor updates

2018-05-04 Thread Johannes Loher via Digitalmars-d-announce
On Friday, 4 May 2018 at 02:59:10 UTC, Nick Sabalausky (Abscissa) 
wrote:

An all-D MySQL/MariaDB client library:
https://github.com/mysql-d/mysql-native
==

Tagged release, 'v2.2.2'.

Sorry, no "zero date" fix just yet, but I think we're getting 
close (#65).


In this version:
- Fixed #177: Update unit-threaded, and don't lock mysql-native 
to a specific version of unit-threaded. (@ghost91)
- Fixed #178, #179: Fix deprecation message in DMD v2.080.0: 
Replace enforceEx by enforce (@ghost91)


Full changelog:
https://github.com/mysql-d/mysql-native/blob/master/CHANGELOG.md


Thanks for merging and releasing this so quickly, it helps me a 
lot!


  1   2   >