Re: Pyd updates

2018-06-03 Thread Norm via Digitalmars-d

On Monday, 4 June 2018 at 01:17:31 UTC, Norm wrote:

On Monday, 4 June 2018 at 00:53:26 UTC, ROB wrote:
On Wednesday, 12 July 2006 at 23:35:55 UTC, Kirk McDonald 
wrote:

[...]


has there been any updates since July 2006 there does not seem 
to be any new msg's since unless you have forked this forum to 
a new location.  if you have please provide I am new to D I 
have been learning python for some time and thought Python and 
D would work well together.


Also are there any Projects using it yet I would like to get 
involved and contribute if possible.


Try this repo:

https://github.com/ariovistus/pyd
https://github.com/ariovistus/pyd/wiki


Sorry I meant to post this link for the wiki:

https://wiki.dlang.org/Programming_in_D_for_Python_Programmers




Re: Pyd updates

2018-06-03 Thread Norm via Digitalmars-d

On Monday, 4 June 2018 at 00:53:26 UTC, ROB wrote:

On Wednesday, 12 July 2006 at 23:35:55 UTC, Kirk McDonald wrote:

[...]


has there been any updates since July 2006 there does not seem 
to be any new msg's since unless you have forked this forum to 
a new location.  if you have please provide I am new to D I 
have been learning python for some time and thought Python and 
D would work well together.


Also are there any Projects using it yet I would like to get 
involved and contribute if possible.


Try this repo:

https://github.com/ariovistus/pyd
https://github.com/ariovistus/pyd/wiki



Re: Pyd updates

2018-06-03 Thread ROB via Digitalmars-d

On Wednesday, 12 July 2006 at 23:35:55 UTC, Kirk McDonald wrote:
If anyone's interested, I just did some fairly major 
refactoring of how Pyd wraps functions. I've essentially 
written my own tuple/metaprogramming library. (Well, at least a 
limited one.) I'm not sure if the new code is any shorter, but 
it is at least split into smaller, more easily read and reused 
chunks.


And I do realize that the code is a bit of a mess in places 
(the tuples library could use some weed-whacking and 
documenting: 
http://dsource.org/projects/pyd/browser/trunk/infrastructure/pyd/tuples.d), but I'm not sure how motivated I am to reorganize it. :-)


has there been any updates since July 2006 there does not seem to 
be any new msg's since unless you have forked this forum to a new 
location.  if you have please provide I am new to D I have been 
learning python for some time and thought Python and D would work 
well together.


Also are there any Projects using it yet I would like to get 
involved and contribute if possible.


Re: dub subpckages and how to depend on them internally

2018-06-03 Thread aliak via Digitalmars-d

On Sunday, 3 June 2018 at 15:23:52 UTC, Jesse Phillips wrote:

On Sunday, 3 June 2018 at 12:08:44 UTC, aliak wrote:


The exact error for that setup is:

source/app.d(4,9): Error: module `liba` is in file 
'lib/liba.d' which cannot be read

import path[0] = source/
import path[1] = ../lib/liba/source/
import path[2] = ../lib/libb/source/
import path[3] = /usr/local/opt/dmd/include/dlang/dmd


Am I missing sourcePaths or something somewhere?


This is a very complicated answer, so I made a pull request 
instead:


https://github.com/aliak00/dub-subpackages/pull/1

lib/liba/source/suba

corrected:

lib/liba/source/liba/suba


Ahhh, I see where I went wrong now. Thanks a lot for the help! 
And I like the extras you threw in there as well :D


Cheers
- Ali




Re: D on top of Hacker News!

2018-06-03 Thread JakubJ via Digitalmars-d

On Sunday, 3 June 2018 at 16:58:23 UTC, Sameer Pradhan wrote:

It was nice to read Walter's article from 2014...
Wonder who posted it, and how long it will stay in the 
visibility range, but it was a nice feeling to see it at the 
top.


--
Sameer


Hi Sameer, I just discovered it today and posted it afterwards. 
Then, looked into this forum and surprise ;) .


However, I don't plan on jumping into D right now because I'm 
starting to use Elixir/OTP seriously at GSoC and between that and 
the finals at uni there's little time left.


Jakub


Re: D on top of Hacker News!

2018-06-03 Thread I love Ice Cream via Digitalmars-d
Is D really a top 20 language? I don't remember seeing it 
anywhere close to the top 20.



https://www.tiobe.com/tiobe-index/ has them in 31


Top comment is kind of depressing.


D on top of Hacker News!

2018-06-03 Thread Sameer Pradhan via Digitalmars-d

It was nice to read Walter's article from 2014...
Wonder who posted it, and how long it will stay in the visibility 
range, but it was a nice feeling to see it at the top.


--
Sameer


Re: Simple tutorials for complex subjects

2018-06-03 Thread rikki cattermole via Digitalmars-d

On 04/06/2018 4:25 AM, Ethan wrote:
Step seven: In your receive function that takes a byte stream, put in a 
switch statement that looks a little bit like the following:


switch( msg.GetID )
{
     static foreach( Message; ServerMessages )
     {
     case ObjectIDOf!Message:
     Message deserialised = msg.FromBinary!Message;
     this.receive( deserialised );
     }
     default:
     break;
}


Make that a final switch, that should generate better assembly.


Simple tutorials for complex subjects

2018-06-03 Thread Ethan via Digitalmars-d

Hey dlang community.

I've already been thinking in advance for DConf next year. If 
things keep going well for me, I may not have anything I can 
publicly talk about. So I've been thinking about what kind of 
capacity I can contribute to the conference.


The easy way would be to raise my hand for volunteering to be MC. 
I get good feedback about my humour and energy levels during my 
talks, and translating that to an entire event means I could 
probably relax for a change and not worry about making mistakes 
in my talk/actually getting everything ready in time.


Another thing that's becoming apparent though is that there needs 
to be more widely-available, simple to understand tutorials for 
the kind of work I do. There's Andrei's book, which is the first 
stop shop. And then there's Adam's D Cookbook. But I can't think 
of much else.


So. Being the kind of programming communist I am, I write 
something cool and think "I need to talk about this." Hence the 
posts I've made in here lately. But it also got me thinking. 
Maybe these kind of posts would make a great DConf talk. Or a 
website. Or whatever, I'm only coming in to this with the 
mentality of DConf next year.


This is something I've emailed to friends/posted to Facebook (but 
slightly sanitised so that the troll from Melbourne hiding behind 
a Tor connection won't derail the thread with "sex talk" 
complaints). It discusses stuff at a high level, with only a 
handful of specific examples. And I can go in to details. But 
keeping things understandable at a high level and using a bit of 
humour at the same time goes a very long way in my experience.


So if stuff like the following, but presented for a proper 
audience, seems like it'll be valuable, I'll add all these 
examples I'm writing to a presentation as I go throughout the 
year and submit that for my talk when the time comes.


===

I've been writing a client/server architecture. In D.

And I harp on about D, I know. But wow is it making things easy.

The kind of programming paradigms I'm using to get it down to 
"simple as pie usability" aren't widely known outside of the D 
community's best and brightest. But knowing what the language is 
capable of, I can just go ahead and do it and it works.


So you're a client and a server. Which means you're going to want 
to send and receive messages to each other. How would you do this 
in C++? Maybe an enum for message type so you can switch on it? 
Then some way of casting the data from the bytestream? And what 
about variable length messages? So rather than cast you need a 
proper deserialisation. Just send everything as JSON? Yeah, 
goodbye network bandwidth, but at least you don't have to mess 
around with binary.


The only method there that is low-maintenance for futureproofing 
is the JSON method I mentioned. And many people will stop there 
and be happy. But I'm not stopping there. I'm writing a gaming 
middleware, which implicitly means there's going to be large 
quantities of data I'll need to deal with.


So, how do you make maintenance a breeze when you write such a 
system from scratch?


Step one: All your messages are structs. "Value types" for you 
modern programmers.


Step two: Apply a user-defined attribute to your struct. I have 
ClientMsg for messages sent by the client, and ServerMsg for 
messages sent by the server. What if both client and server send 
the message?


@ClientMsg @ServerMsg struct Ping { }

Done.

Step three: Collect all messages from the message modules and 
stick them in a tuple. No need to register your message. It's 
done for you.


Step four: Filter that tuple out in to separate client and server 
message tuples.


Step five: Write a template that generates a size_t that hashes 
together the names of all members of any given message. This has 
the built-in benefit of loosely versioning your structures. And 
thanks to CTFE and collecting all message types earlier, we can 
check at compile time for hash collisions.


Step six: Serialisation of your structures starts out by sticking 
that size_t in a buffer, and then parsing each member of your 
struct and either copying in to the buffer directly or specifying 
a length before copying N elements from the array you've 
encountered. Deserialisation works in the exact opposite manner.


Step seven: In your receive function that takes a byte stream, 
put in a switch statement that looks a little bit like the 
following:


switch( msg.GetID )
{
static foreach( Message; ServerMessages )
{
case ObjectIDOf!Message:
Message deserialised = msg.FromBinary!Message;
this.receive( deserialised );
}
default:
break;
}

Yes, we basically generate at compile time an entire switch 
statement from structures. This currently will generate a fairly 
inefficient jump table, but you know, we can add an indexing 
declarator to that foreach statement and let the compiler 
optimise down to a proper jump table with a little bit more 
effo

Re: dub subpckages and how to depend on them internally

2018-06-03 Thread Jesse Phillips via Digitalmars-d

On Sunday, 3 June 2018 at 12:08:44 UTC, aliak wrote:


The exact error for that setup is:

source/app.d(4,9): Error: module `liba` is in file 'lib/liba.d' 
which cannot be read

import path[0] = source/
import path[1] = ../lib/liba/source/
import path[2] = ../lib/libb/source/
import path[3] = /usr/local/opt/dmd/include/dlang/dmd


Am I missing sourcePaths or something somewhere?


This is a very complicated answer, so I made a pull request 
instead:


https://github.com/aliak00/dub-subpackages/pull/1

lib/liba/source/suba

corrected:

lib/liba/source/liba/suba


Re: Installation on Ubuntu 18.04 is broken

2018-06-03 Thread bachmeier via Digitalmars-d

On Saturday, 2 June 2018 at 00:30:09 UTC, Norm wrote:


Get a new distro.



Which other major language doesn't work on Ubuntu?


Re: Installation on Ubuntu 18.04 is broken

2018-06-03 Thread bachmeier via Digitalmars-d

On Saturday, 2 June 2018 at 00:11:58 UTC, Seb wrote:
The bug you referenced has long been fixed and is part of 
2.080.0


I guess my computer was trolling me then, because it didn't work.

Please do report a bug with instructions on how to reproduce if 
you are still experiencing problems.


As I wrote in the post that followed, it worked after I 
uninstalled, installed an additional package, and reinstalled.




Re: dub subpckages and how to depend on them internally

2018-06-03 Thread aliak via Digitalmars-d

On Thursday, 31 May 2018 at 20:01:43 UTC, Jesse Phillips wrote:

On Thursday, 31 May 2018 at 17:56:57 UTC, aliak wrote:

root
 |-- sub1/source
 |-- sub2/source


Do that.

You can have a top level source folder, but this is going to be 
code separate from your subpackage. The subpackage can depend 
on this top-level project, or the top-level project can depend 
on the subpackage.


Ok I tried this as well, but I still get a

module `sub1` is in file 'lib/sub1.d' which cannot be read

I put up a GH test project with exactly what I'm doing. 
https://github.com/aliak00/dub-subpackages. There's a "lib" 
project that has subpackages "liba" and "libb" and there's a test 
application that tries to use the subpackages in different ways.


The exact error for that setup is:

source/app.d(4,9): Error: module `liba` is in file 'lib/liba.d' 
which cannot be read

import path[0] = source/
import path[1] = ../lib/liba/source/
import path[2] = ../lib/libb/source/
import path[3] = /usr/local/opt/dmd/include/dlang/dmd


Am I missing sourcePaths or something somewhere?



Re: stride in slices

2018-06-03 Thread DigitalDesigns via Digitalmars-d

On Sunday, 3 June 2018 at 07:30:56 UTC, Meta wrote:

On Saturday, 2 June 2018 at 18:49:51 UTC, DigitalDesigns wrote:

Proposal:

[a..b;m]

m is the stride, if ; is not a good char then |, :, !, or # 
could be good chars.


This is exactly what std.range.stride does. The syntax [a..b;m] 
directly translates to [a..b].stride(m).



So, can I do

X[a..b].stride(m) = 0;

? Just curious because if it is exactly the same notion then I 
should be able to do it, right?


Of course, I'm sure another hoop could be created to jump through 
and it will work, will it still be exactly the same though?


If there is an efficient and optimal setting so one could get the 
same effect, then I guess it might be a direct translation. If 
not then it isn't.


What I am looking for is a sort of zeromemory or memset with 
stride. It should not allocate a new array or be significantly 
slower. I'd like some proof that they are "equivalent" such as a 
disassembly or a profiling... just to satisfy my own skepticism.






Re: stride in slices

2018-06-03 Thread Seb via Digitalmars-d

On Sunday, 3 June 2018 at 07:30:56 UTC, Meta wrote:

On Saturday, 2 June 2018 at 18:49:51 UTC, DigitalDesigns wrote:

Proposal:

[a..b;m]

m is the stride, if ; is not a good char then |, :, !, or # 
could be good chars.


This is exactly what std.range.stride does. The syntax [a..b;m] 
directly translates to [a..b].stride(m).


We even have slide which is a generalization of stride (striding 
is sliding with a window size of 1):


[a..b].slide(1, m)

https://dlang.org/phobos/std_range.html#slide


Re: stride in slices

2018-06-03 Thread Meta via Digitalmars-d

On Saturday, 2 June 2018 at 18:49:51 UTC, DigitalDesigns wrote:

Proposal:

[a..b;m]

m is the stride, if ; is not a good char then |, :, !, or # 
could be good chars.


This is exactly what std.range.stride does. The syntax [a..b;m] 
directly translates to [a..b].stride(m).