Re: DMD Access Violation

2016-09-26 Thread Jonathan Marler via Digitalmars-d
On Monday, 26 September 2016 at 18:23:33 UTC, Stefan Koch wrote: On Monday, 26 September 2016 at 18:07:44 UTC, Jonathan Marler Does anyone else get an access violation in the first case? Is this a known bug? Cyclic dependency. File a dmd bug please. Well I'm not sure if it's a bug with the

DMD Access Violation

2016-09-26 Thread Jonathan Marler via Digitalmars-d
My dmd compiler gets an Access Violation when compiling this code: public template TemplateWrapper(T) { alias ToAlias = T; } public class Bar : Foo { TemplateWrapper!(Bar) something; } public class Foo { static class StaticClass : Bar { }

Re: Module Clarification

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 20:09:41 UTC, Steven Schveighoffer wrote: Before package.d support, you could not do any importing of packages. You could only import modules. package.d was how the compiler allowed importing packages. I don't know that there is a fundamental difference

Re: D code optimization

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: It is often being claimed that D is at least as fast as C++. Now, I am fairly new to D. But, here is an example where I want to see how can this be made possible. So far my C++ code compiles in ~850 ms. While my D code runs in about

Re: Module Clarification

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 15:02:01 UTC, Lodovico Giaretta wrote: I think that having package.d provides a better layout. Look at the difference between this: ls std/experimental drw-rw-rw- allocator drw-rw-rw- logger drw-rw-rw- ndslice -rw-rw-rw- typecons.d and this: ls

Re: Module Clarification

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 11:40:17 UTC, Steven Schveighoffer wrote: This should be fine. x/package.d is equivalent to module x. Ok, it looks like no-one thought what I was doing was off-base. I guess this brings up another question. Why doesn't the compiler support modules in a

Re: Stacktrace on Null Pointer Derefence

2016-09-21 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 23:36:08 UTC, Nordlöw wrote: Doing a null deref such as int* y = null; *y = 42;// boom [...] Can you include compiler command line? I use -g -gs -debug to get stack traces on windows.

Module Clarification

2016-09-21 Thread Jonathan Marler via Digitalmars-d-learn
I'm working on a code generation tool and wanted to make sure my module approach was correct. The generated code has a module hierarchy, where modules can appear at any level of the hierarchy. module foo; module foo.bar; In this case, module foo and foo.bar are independent modules. The foo

Re: Default Template Instantiation

2016-09-19 Thread Jonathan Marler via Digitalmars-d
On Monday, 19 September 2016 at 22:17:34 UTC, Mathias Lang wrote: 2016-09-19 23:18 GMT+02:00 Jonathan Marler via Digitalmars-d < digitalmars-d@puremagic.com>: [...] No you can't. The example is wrong, but Stefan is right. Consider: ``` template Foo (T = string) { } template Take

Re: Default Template Instantiation

2016-09-19 Thread Jonathan Marler via Digitalmars-d
On Monday, 19 September 2016 at 21:14:38 UTC, Stefan Koch wrote: On Monday, 19 September 2016 at 21:09:37 UTC, Jonathan Marler wrote: I don't know if I would call this a "destabalizing" language change though. It should be backwards compatible with the existing semantics. It adds an extra

Re: Default Template Instantiation

2016-09-19 Thread Jonathan Marler via Digitalmars-d
On Monday, 19 September 2016 at 20:47:00 UTC, Stefan Koch wrote: On Monday, 19 September 2016 at 20:21:30 UTC, Jonathan Marler wrote: Yes that's why the template cannot deduce the parameters. The question is, when the parameters cannot be deduced, and they are all optional, would it be

Re: Default Template Instantiation

2016-09-19 Thread Jonathan Marler via Digitalmars-d
On Monday, 19 September 2016 at 19:53:27 UTC, Basile B. wrote: On Monday, 19 September 2016 at 19:38:37 UTC, Jonathan Marler wrote: If you have a template where: 1) All parameters are optional 2) The parameters cannot be deduced Would it be reasonable to instantiate the template with the

Default Template Instantiation

2016-09-19 Thread Jonathan Marler via Digitalmars-d
If you have a template where: 1) All parameters are optional 2) The parameters cannot be deduced Would it be reasonable to instantiate the template with the default parameter values? For example: template Foo(string str = "some string", T...) { class Foo { // class

Mutable class reference to immutable class

2016-09-10 Thread Jonathan Marler via Digitalmars-d-learn
This is been bugging me for a while. Is it possible to have a mutable reference to an immutable class? In other words, can you set a class variable to an immutable class, and then set that variable to another immutable class later? Mutable "slices" to immutable data are easy:

Re: Command Line Utility Library

2016-08-15 Thread Jonathan Marler via Digitalmars-d-learn
On Monday, 15 August 2016 at 10:48:11 UTC, Seb wrote: Are you trying to parse arguments? There's a lot of good stuff for it already: https://dlang.org/phobos/std_getopt.html https://code.dlang.org/packages/darg https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/ For configuration

Re: rdmd configuration files

2016-08-11 Thread Jonathan Marler via Digitalmars-d
On Thursday, 11 August 2016 at 22:14:35 UTC, Lodovico Giaretta wrote: [...] I didn't know about that last feature, that's pretty cool. Maybe dub is the right way to go, thanks for the input.

Re: rdmd configuration files

2016-08-11 Thread Jonathan Marler via Digitalmars-d
On Thursday, 11 August 2016 at 21:58:35 UTC, Chris Wright wrote: On Thu, 11 Aug 2016 20:44:12 +, Lodovico Giaretta wrote: In file rdmd_wrapper.sh: rdmd -my-special -command-line -parameters $* When you call it this way: ./rdmd_wrapper mymodule.d You can add parameters inside the file

Re: rdmd configuration files

2016-08-11 Thread Jonathan Marler via Digitalmars-d
On Thursday, 11 August 2016 at 20:44:12 UTC, Lodovico Giaretta wrote: On Thursday, 11 August 2016 at 18:47:05 UTC, Jonathan Marler wrote: ... Additionally, allowing rdmd to be configured through files makes more complicated configurations more reasonable. For example, if your scripts depend

rdmd configuration files

2016-08-11 Thread Jonathan Marler via Digitalmars-d
The use case is you have a collection of D scripts within the same directory subtree (maybe a git repo) that all share some common configuration. Maybe they all require extra search paths to find source/libraries, or they all throw exceptions to the user and should be compiled with debug

Re: New __FILE_DIR__ trait?

2016-07-29 Thread Jonathan Marler via Digitalmars-d
On Thursday, 28 July 2016 at 17:21:52 UTC, Sebastien Alaiwan wrote: On Thursday, 28 July 2016 at 06:21:06 UTC, Jonathan Marler wrote: auto __DIR__(string fileFullPath = __FILE_FULL_PATH__) pure { return fileFullPath.dirName; } Doesn't work, I don't think you can wrap such things (

Re: New __FILE_DIR__ trait?

2016-07-28 Thread Jonathan Marler via Digitalmars-d
On Thursday, 28 July 2016 at 00:42:11 UTC, crimaniak wrote: On Wednesday, 27 July 2016 at 13:59:23 UTC, Jonathan Marler wrote: For others who may see this thread, the __FULL_FILE_PATH__ special trait was added to the dmd compiler with this PR: https://github.com/dlang/dmd/pull/5959 __DIR__

Re: New __FILE_DIR__ trait?

2016-07-27 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 27 July 2016 at 14:07:23 UTC, lkfsdg wrote: On Wednesday, 27 July 2016 at 13:59:23 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 02:08:44 UTC, Jonathan Marler wrote: [...] For others who may see this thread, the __FULL_FILE_PATH__ special trait was added to the dmd

Re: New __FILE_DIR__ trait?

2016-07-27 Thread Jonathan Marler via Digitalmars-d
On Friday, 22 July 2016 at 02:08:44 UTC, Jonathan Marler wrote: I've got some batch scripts I wanted to convert to D. I'd like users to run them using rdmd, so it's obvious where the source code lives and easy to modify. The problem is that the batch scripts I want to convert rely on the

Re: full path to source file __FILE__

2016-07-27 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 21 July 2016 at 19:54:34 UTC, Jonathan Marler wrote: Is there a way to get the full path of the current source file? Something like: __FILE_FULL_PATH__ I'm asking because I'm rewriting a batch script in D, meant to be ran with rdmd. However, the script needs to know it's own

Re: @gc attribute for bypassign @nogc

2016-07-24 Thread Jonathan Marler via Digitalmars-d
On Monday, 25 July 2016 at 03:18:17 UTC, rikki cattermole wrote: On 25/07/2016 10:13 AM, bitwise wrote: [...] I've been saying for a very long time we need @assumenogc attribute like we have @trusted for @safe. I havent seen this assumegc propsal before, could you provide the definition

Re: Should I write an OSC library for D, or is it a sunken ship?

2016-07-24 Thread Jonathan Marler via Digitalmars-d
On Sunday, 24 July 2016 at 17:29:02 UTC, lqjglkqjsg wrote: On Sunday, 24 July 2016 at 17:08:27 UTC, Jonathan Marler wrote: On Sunday, 24 July 2016 at 17:02:08 UTC, lqjglkqjsg wrote: On Sunday, 24 July 2016 at 16:01:39 UTC, Jonathan Marler wrote: [...] [...] This type of discussion sounds

Re: Should I write an OSC library for D, or is it a sunken ship?

2016-07-24 Thread Jonathan Marler via Digitalmars-d
On Sunday, 24 July 2016 at 17:02:08 UTC, lqjglkqjsg wrote: On Sunday, 24 July 2016 at 16:01:39 UTC, Jonathan Marler wrote: [...] And inside software ? The only one I remember for implementing OSC was Reaktor. actually even the hosts didn't implement it. MIDI can't die because people still

Re: Should I write an OSC library for D, or is it a sunken ship?

2016-07-24 Thread Jonathan Marler via Digitalmars-d
On Sunday, 24 July 2016 at 15:48:22 UTC, lqjglkqjsg wrote: On Sunday, 24 July 2016 at 15:33:24 UTC, solidstate1991 wrote: After I started to get into a near usable state with my game engine, which originally called as VDP-engine, now it's renamed to Pixel Perfect (

Re: Cannot compare object.opEquals is not nogc

2016-07-24 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 24 July 2016 at 15:41:55 UTC, Lodovico Giaretta wrote: On Sunday, 24 July 2016 at 15:28:53 UTC, Jonathan Marler wrote: Whoa wait a second...I didn't know you could do this. I thought everything had to inherit from the object class. Can you share the syntax to define a class that

Re: Cannot compare object.opEquals is not nogc

2016-07-24 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 24 July 2016 at 15:09:53 UTC, Lodovico Giaretta wrote: Remember that comparison of complex objects may require normalization, which may change the objects themselves and allocate memory. Sure but this case will be the exception. If an application really needs this they can

Re: Cannot compare object.opEquals is not nogc

2016-07-24 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 24 July 2016 at 09:03:04 UTC, Lodovico Giaretta wrote: On Sunday, 24 July 2016 at 02:17:27 UTC, Rufus Smith wrote: [...] Now you are telling me to "program by trust", because there's nothing ensuring that I remember to free everything I allocated with malloc/free, while a GC

Re: Modules

2016-07-24 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 24 July 2016 at 02:45:57 UTC, rikki cattermole wrote: On 24/07/2016 2:28 PM, Rufus Smith wrote: NM, ignore. Seems it was something else going on. Although, if you know how how dmd resolves this stuff exactly, it would be nice to know. Does it just use the module names regardless of

Re: Default implementations in inherited interfaces

2016-07-24 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 21 July 2016 at 13:37:30 UTC, Saurabh Das wrote: On Thursday, 21 July 2016 at 12:42:14 UTC, Adam D. Ruppe wrote: On Thursday, 21 July 2016 at 09:41:27 UTC, Saurabh Das wrote: Java 8 has a 'default' keyword that allows interfaces to provide a default implementation and sub-classes

Re: Cannot compare object.opEquals is not nogc

2016-07-24 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 24 July 2016 at 02:17:27 UTC, Rufus Smith wrote: On Saturday, 23 July 2016 at 22:48:07 UTC, Lodovico Giaretta wrote: [...] This just isn't right. What your saying is that because someone screwed up, we must live with the screw up and build everyone around the screw up. This

Re: Cannot compare object.opEquals is not nogc

2016-07-23 Thread Jonathan Marler via Digitalmars-d-learn
On Saturday, 23 July 2016 at 16:46:20 UTC, Jonathan Marler wrote: [...] Actually Im going to disagree with myself. This technique actually wouldn't work with virtual methods:)

Re: Cannot compare object.opEquals is not nogc

2016-07-23 Thread Jonathan Marler via Digitalmars-d-learn
On Saturday, 23 July 2016 at 15:25:02 UTC, Steven Schveighoffer wrote: On 7/23/16 10:53 AM, Rufus Smith wrote: On Saturday, 23 July 2016 at 14:15:03 UTC, Lodovico Giaretta wrote: On Saturday, 23 July 2016 at 13:18:03 UTC, Rufus Smith wrote: Trying to compare a *ptr value with a value in nogc

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 19:23:30 UTC, Steven Schveighoffer wrote: On 7/22/16 2:43 PM, Kagamin wrote: On Friday, 22 July 2016 at 13:50:55 UTC, Jonathan Marler wrote: shell/anypath> rdmd /somedir/clean.d Removing /somedir/build... So for command rdmd /somedir/clean.d what __FILE__ contains?

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 19:13:31 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 14:02:03 UTC, Jonathan Marler wrote: The __FILE__ trait seems to be used most useful for error messages. Another usage is for testing parsers or string functions directly on the source. E.g in "devel" mode

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 09:37:24 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 08:36:37 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 07:57:35 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 13:30:10 UTC, Steven Schveighoffer wrote: On 7/22/16 3:47 AM, Jonathan Marler wrote: What's wrong with __FILE__.dirName ? It's kinda weird, sometimes I've noticed that the __FILE__ keyword is an absolute path, and sometimes it isn't. If you combine it with

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 07:57:35 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wrote: What's wrong with __FILE__.dirName ? It's kinda weird, sometimes I've noticed that the __FILE__ keyword is an

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 06:45:58 UTC, Jacob Carlborg wrote: On 2016-07-22 04:24, Jonathan Marler wrote: The script depends on other files relative to where it exists on the file system. I couldn't think of a better design to find these files then knowing where the script exists, can you?

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wrote: On Thursday, 21 July 2016 at 19:54:34 UTC, Jonathan Marler wrote: Is there a way to get the full path of the current source file? Something like: __FILE_FULL_PATH__ I'm asking because I'm rewriting a batch script in D, meant to be ran

Re: New __FILE_DIR__ trait?

2016-07-22 Thread Jonathan Marler via Digitalmars-d
On Friday, 22 July 2016 at 04:10:38 UTC, rikki cattermole wrote: On 22/07/2016 2:08 PM, Jonathan Marler wrote: P.S. If you know of an existing solution to this problem please let me know. Temporary work around: Write a program that on calls to rdmd but before that it appends an enum called

Re: full path to source file __FILE__

2016-07-21 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 21 July 2016 at 22:57:06 UTC, Jonathan M Davis wrote: On Thursday, July 21, 2016 18:39:45 Steven Schveighoffer via Digitalmars-d- learn wrote: [...] It would be pretty terrible actually to put the executable in the source path, and in many cases, the user wouldn't even have the

Re: full path to source file __FILE__

2016-07-21 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 01:52:57 UTC, Adam D. Ruppe wrote: On Thursday, 21 July 2016 at 22:47:42 UTC, Jonathan Marler wrote: I explain in the original post. Any ideas Adam? Thanks in advance. But why does the batch script use it? Since you are rewriting anyway, maybe you can find an

New __FILE_DIR__ trait?

2016-07-21 Thread Jonathan Marler via Digitalmars-d
I've got some batch scripts I wanted to convert to D. I'd like users to run them using rdmd, so it's obvious where the source code lives and easy to modify. The problem is that the batch scripts I want to convert rely on the %~dp0 variable, which contains the path to the batch script itself.

Re: full path to source file __FILE__

2016-07-21 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 21 July 2016 at 22:39:45 UTC, Steven Schveighoffer wrote: On 7/21/16 3:54 PM, Jonathan Marler wrote: Is there a way to get the full path of the current source file? Something like: __FILE_FULL_PATH__ I'm asking because I'm rewriting a batch script in D, meant to be ran with

Re: full path to source file __FILE__

2016-07-21 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 21 July 2016 at 22:33:39 UTC, Adam D. Ruppe wrote: On Thursday, 21 July 2016 at 22:28:39 UTC, zabruk70 wrote: won't? what this means? That gives the path to the .exe but he wants the path to the .d. But why? I would think the current working directory is probably adequate and

full path to source file __FILE__

2016-07-21 Thread Jonathan Marler via Digitalmars-d-learn
Is there a way to get the full path of the current source file? Something like: __FILE_FULL_PATH__ I'm asking because I'm rewriting a batch script in D, meant to be ran with rdmd. However, the script needs to know it's own path. The original batch script uses the %~dp0 variable for this,

Re: Casting classes

2016-07-01 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 1 July 2016 at 17:34:25 UTC, Basile B. wrote: On Friday, 1 July 2016 at 17:32:26 UTC, Basile B. wrote: On Friday, 1 July 2016 at 15:45:35 UTC, Jonathan Marler wrote: How do casts work under the hood? I'm mostly interested in what needs to be done in order to cast a class to a

Casting classes

2016-07-01 Thread Jonathan Marler via Digitalmars-d-learn
How do casts work under the hood? I'm mostly interested in what needs to be done in order to cast a class to a subclass. I'd like to know what is being done to determine whether the object is a valid instance of the cast type. If the code is implemented in the druntime, a pointer to where

Re: Associative array of const items

2016-07-01 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 1 July 2016 at 06:57:59 UTC, QAston wrote: On Thursday, 30 June 2016 at 17:08:45 UTC, Jonathan Marler wrote: Is there a way to have an associative array of const values? I thought it would have been: const(T)[K] map; map[x] = y; but the second line gives Error: cannot modify const

Associative array of const items

2016-06-30 Thread Jonathan Marler via Digitalmars-d-learn
Is there a way to have an associative array of const values? I thought it would have been: const(T)[K] map; map[x] = y; but the second line gives Error: cannot modify const expression. I would think that the const(T)[K] would behave similarly to const(T)[], where you can modify the array,

Re: Cast vs Virtual Method vs TypeId?

2016-06-30 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 30 June 2016 at 00:27:57 UTC, rikki cattermole wrote: On 30/06/2016 12:25 PM, Jonathan Marler wrote: Assume you have a function that accepts a GameObject but does something special if that GameObject happens to be an instance of the Player class. How would you go about determining

Cast vs Virtual Method vs TypeId?

2016-06-29 Thread Jonathan Marler via Digitalmars-d-learn
I'd like to hear peoples thoughts on the various solutions for the following problem. Say you have some hierarchy of classes like: class GameObject { // ... } class Entity : GameObject { // ... } class Player : Entity { // ... } class Enemy : Entity { // ... } // ... Assume you have

Forward References

2016-06-27 Thread Jonathan Marler via Digitalmars-d-learn
Do the various D compilers use multiple passes to handle forward references or some other technique?

Re: Garbage Collector

2016-06-16 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 15 June 2016 at 13:38:33 UTC, ketmar wrote: On Wednesday, 15 June 2016 at 13:19:31 UTC, Konstantin wrote: I don’t believe a community is capable of creating a good GC. you are wrong. and you definitely know nothing about garbage collection, virtual machines and code generation.

Re: Bug in Rdmd?

2016-06-13 Thread Jonathan Marler via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 03:40:01 UTC, Adam D. Ruppe wrote: On Tuesday, 14 June 2016 at 03:15:04 UTC, Jonathan Marler wrote: It actually is a free function no, it isn't, it is on File. Your code doesn't compile on my dmd (and indeed it shouldn't on yours either unless you have a version

Re: Bug in Rdmd?

2016-06-13 Thread Jonathan Marler via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 01:35:32 UTC, Jeremy DeHaan wrote: On Tuesday, 14 June 2016 at 01:05:46 UTC, Jonathan Marler wrote: This code doesn't seem to work with rdmd. Is this a bug? import std.stdio : byLine; int main(string[] args) { foreach(line; stdin.byLine) { }

Bug in Rdmd?

2016-06-13 Thread Jonathan Marler via Digitalmars-d-learn
This code doesn't seem to work with rdmd. Is this a bug? import std.stdio : byLine; int main(string[] args) { foreach(line; stdin.byLine) { } return 0; } Compiler Output: Error: module std.stdio import 'byLine' not found

Re: I'd love to see DScript one day ...

2016-06-11 Thread Jonathan Marler via Digitalmars-d
On Saturday, 11 June 2016 at 10:34:41 UTC, Chris wrote: On Saturday, 11 June 2016 at 10:14:25 UTC, qznc wrote: [...] No, JS is here to stay, unfortunately. Good news, take a look at asmjs.org In the future you'll be able to compile your D code into javascript assembly, and run it in the

Finish Winsock Bindings in DRuntime

2016-06-11 Thread Jonathan Marler via Digitalmars-d
I'd like to get the rest of winsock in druntime. I'm willing to work on this and submit a PR but didn't want to work on something if someone else was already doing it or if it turns out that we don't actually want this in druntime. We've discussed the best option moving forward here:

Re: Fibers under the hood

2016-06-09 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 9 June 2016 at 11:45:01 UTC, Andrew Edwards wrote: On 6/9/16 2:15 PM, Jonathan Marler wrote: On Thursday, 9 June 2016 at 05:07:33 UTC, Nikolay wrote: On Thursday, 9 June 2016 at 04:57:30 UTC, Jonathan Marler wrote: I've googled and searched through the forums but haven't found

Re: Fibers under the hood

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 9 June 2016 at 05:07:33 UTC, Nikolay wrote: On Thursday, 9 June 2016 at 04:57:30 UTC, Jonathan Marler wrote: I've googled and searched through the forums but haven't found too much on how fibers are implemented. How does yield return execution to the caller but then resume

Fibers under the hood

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
I've googled and searched through the forums but haven't found too much on how fibers are implemented. How does yield return execution to the caller but then resume execution in the same place on the next call? Also some information on how the fiber call stack works would be nice. I'm

Re: dlang.org using apache?

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 17:43:03 UTC, Seb wrote: On Wednesday, 8 June 2016 at 17:05:42 UTC, Jonathan Marler wrote: On Wednesday, 8 June 2016 at 15:51:58 UTC, Adam D. Ruppe wrote: On Wednesday, 8 June 2016 at 15:05:54 UTC, Ola Fosheim Grøstad wrote: The forum-index http header report:

Re: dlang.org using apache?

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 15:51:58 UTC, Adam D. Ruppe wrote: On Wednesday, 8 June 2016 at 15:05:54 UTC, Ola Fosheim Grøstad wrote: The forum-index http header report: Server:nginx/1.4.6 (Ubuntu) People check out stuff like that. Yeah, and that's an industry-standard production

Re: dlang.org using apache?

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 14:43:35 UTC, Mike Parker wrote: Really? I just don't see it as that big of a deal. Again, three subdomains are using D right now. So it's not like it's not being used at all. Moving the website to D just hasn't been a priority (nor should it be, IMO). Anyone in

Re: dlang.org using apache?

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 14:30:53 UTC, Adam D. Ruppe wrote: These servers tend to be very efficient at front end tasks like load balancing, static file serving and cache management, standards compliance (including automatically up/down grading HTTP versions or TLS requirements),

Re: dlang.org using apache?

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 13:32:00 UTC, Mike Parker wrote: Why would we change over when Apache is working quite happily to serve up static content? I've heard that same argument as the reason people don't use the D language. Why would I change over to D when C/C++ is working quite

dlang.org using apache?

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
I've decided to write a web application using vibe and was shocked to see that dlang.org was using apache. Should I be scared that even after this long, the official D website doesn't rely on its own web tools?

Re: core.sys.windows so lean?

2016-06-06 Thread Jonathan Marler via Digitalmars-d-learn
On Monday, 6 June 2016 at 17:11:44 UTC, Vladimir Panteleev wrote: On Monday, 6 June 2016 at 16:51:20 UTC, Jonathan Marler wrote: Hmmm...it seems to be missing quite alot though. You could've mentioned you meant just the winsock modules. They have not been brought over because they were not

Re: core.sys.windows so lean?

2016-06-06 Thread Jonathan Marler via Digitalmars-d-learn
On Monday, 6 June 2016 at 16:13:48 UTC, Vladimir Panteleev wrote: On Monday, 6 June 2016 at 16:04:30 UTC, Jonathan Marler wrote: I'm writing some platform specific D code and I've found that what the druntime exposes for the windows platform is pretty lean. I'm guessing that the purpose of

core.sys.windows so lean?

2016-06-06 Thread Jonathan Marler via Digitalmars-d-learn
I'm writing some platform specific D code and I've found that what the druntime exposes for the windows platform is pretty lean. I'm guessing that the purpose of the druntime version of the windows api is to implement the minimum required to support the windows platform and not meant to be a

Is this possible in D?

2015-02-19 Thread Jonathan Marler via Digitalmars-d-learn
I am having a heck of a time trying to figure out how to do this. How do I change the attributes of a function based on the version without copying the function body? For example: version(StaticVersion) { static void myLongFunction() { // long body ... } } else { void

Re: Is this possible in D?

2015-02-19 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 19 February 2015 at 17:23:47 UTC, Mike Parker wrote: I agree that string mixins can kill readability. I encountered that when I used them to support both D1 and D2 in Derelict 2 years ago. But I think that when they are kept small and local as in cases like this, they aren't bad

Re: Plan for Exceptions and @nogc?

2015-02-18 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 18 February 2015 at 14:46:30 UTC, Dicebot wrote: From my POV best proposal from last lengthy discussion was to enable reference-counted non-gc-heap Exceptions. But that needs a language change because RefCounted!T is a struct and thus neither can be thrown nor can be part of

Quick help on version function parameter

2015-02-18 Thread Jonathan Marler via Digitalmars-d-learn
Does anyone know a good way to support versioned function parameters? Say, in one version I want a variable to be a global and in another I want it to be a parameter. version(GlobalVersion) { int x; void foo() { // A huge function that uses x } } else { void

Re: Quick help on version function parameter

2015-02-18 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 23:49:26 UTC, Adam D. Ruppe wrote: I'd write a foo_impl which always takes a parameter. Then do the versioned foo() functions which just forward to it: void foo_impl(int x) { long function using x here } version(globals) { int x; void foo() {

Re: Plan for Exceptions and @nogc?

2015-02-17 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 17 February 2015 at 18:04:53 UTC, Matthias Bentrup wrote: If the unwinding is done after the exception handler is left, the thrower can safely reference the data directly on the stack and the catcher can ignore any data it doesn't need. (It may copy the data to safety if it is

Re: Plan for Exceptions and @nogc?

2015-02-17 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 17 February 2015 at 13:32:40 UTC, Matthias Bentrup wrote: Maybe it is possible to have a separate ScopedThrowable exception class. Those exceptions would be allocated on the stack and would be allowed to carry references to local/scoped data, but they live only for the duration

Re: Plan for Exceptions and @nogc?

2015-02-17 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 17 February 2015 at 18:40:51 UTC, Matthias Bentrup wrote: On Tuesday, 17 February 2015 at 18:30:24 UTC, Jonathan Marler wrote: I thought of the same thing but then realized that it would be impossible to ensure that the catch block wouldn't stomp on that memory. The catcher

Re: Plan for Exceptions and @nogc?

2015-02-17 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 17 February 2015 at 21:30:00 UTC, Matthias Bentrup wrote: On Tuesday, 17 February 2015 at 20:48:07 UTC, Jonathan Marler wrote: That would work if you didn't have to unwind the stack but unfortunately you do. The catch block exists in the context of the function it is written in.

Re: @nogc with assoc array

2015-02-16 Thread Jonathan Marler via Digitalmars-d-learn
On Monday, 16 February 2015 at 17:58:10 UTC, Benjamin Thaut wrote: Because the index operator throws a OutOfRange exception and throwing exceptions allocates, maybe? Oh...I hadn't thought of that! Thanks for the quick response.

@nogc with assoc array

2015-02-16 Thread Jonathan Marler via Digitalmars-d-learn
Why is the 'in' operator nogc but the index operator is not? void main() @nogc { int[int] a; auto v = 0 in a; // OK auto w = a[0]; // Error: indexing an associative // array in @nogc function main may // cause GC allocation }

Re: @nogc with assoc array

2015-02-16 Thread Jonathan Marler via Digitalmars-d-learn
On Monday, 16 February 2015 at 19:12:45 UTC, FG wrote: Range violation is an Error, but never mind that. The real question is: given all the work related to @nogc, wouldn't it be better for such common Errors to be preallocated and only have file and line updated when they are thrown? @nogc

Re: Plan for Exceptions and @nogc?

2015-02-16 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 17 February 2015 at 05:52:23 UTC, philippecp wrote: I was wondering the same myself. I think there would be a lot of negative side effects to using alternate memory model other than GC (non-gc could introduce leaks, on stack has potential to be overwritten). For that reason, I

Re: Plan for Exceptions and @nogc?

2015-02-16 Thread Jonathan Marler via Digitalmars-d
On Tuesday, 17 February 2015 at 07:28:03 UTC, weaselcat wrote: Would RefCounted!T being @nogc help alleviate this issue? I've heard of RefCounted and I understand the concept but I've never used it. I'll do some reading a some experiments. Maybe this will work :)

Plan for Exceptions and @nogc?

2015-02-16 Thread Jonathan Marler via Digitalmars-d
Is there a proposal for how D will support throwing Exceptions in @nogc code in the future? I've searched the forums and found different proposals that involve things like pre-allocated exceptions, non-gc heap allocated exceptions or even stack allocated exceptions. I don't want to debate

Re: @nogc with assoc array

2015-02-16 Thread Jonathan Marler via Digitalmars-d-learn
On Tuesday, 17 February 2015 at 00:00:54 UTC, FG wrote: Yes, they would be in TLS. I know exceptions in general are a complex problem, therefore I limited the comment only to errors, because forbidding the use of `aa[key]` in @nogc seemed odd (although I do think that `aa.get(key, default)`

I can has @nogc and throw Exceptions?

2015-02-13 Thread Jonathan Marler via Digitalmars-d-learn
This question comes from wanting to be able to throw an exception in code that is @nogc. I don't know if it's possible but I'd like to be able to throw an exception without allocating memory for the garbage collector? You can do it in C++ so I think you should be able to in D. One idea I

Re: I can has @nogc and throw Exceptions?

2015-02-13 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 13 February 2015 at 19:13:02 UTC, Steven Schveighoffer wrote: You need to actually allocate the memory on the heap. Your data lives on the stack frame of main, which goes away as soon as main exits, and your exception is caught outside main. -Steve Yes I am aware of this. That

Re: I can has @nogc and throw Exceptions?

2015-02-13 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 13 February 2015 at 19:10:00 UTC, Adam D. Ruppe wrote: On Friday, 13 February 2015 at 19:03:10 UTC, Jonathan Marler wrote: T construct(T,A...)(void* buffer, A args) { return (cast(T)buffer).__ctor(args); } This is wrong, you need to initialize the memory first to the proper

Re: Special Type Challenge

2015-02-06 Thread Jonathan Marler via Digitalmars-d
On Saturday, 7 February 2015 at 03:48:24 UTC, Adam D. Ruppe wrote: wrote: b = -256; that won't fit in a byte btw. Woops, I typed that example too fast :) The rest of the assignment stuff is easy. I'd prolly even do it with a template: this(T)(T t) { this.opAssign(t); } // for

Special Type Challenge

2015-02-06 Thread Jonathan Marler via Digitalmars-d
I'm wondering if the following is possible in D. I tried and failed but maybe someone else will be able to pull it off. // Challenge: Create a type named Byte that, // 1. Uses 1 byte of memory // 2. Can be used as an argument to a non-template function // 3. Handles implicit conversion

Re: Special Type Challenge

2015-02-06 Thread Jonathan Marler via Digitalmars-d
On Saturday, 7 February 2015 at 02:12:08 UTC, Jakob Ovrum wrote: Byte echo(Byte b) { return b; } b = echo('a'); b = echo(cast(const char)'a'); b = echo(cast(immutable char)'a'); b = echo(cast(byte)1); b = echo(cast(const byte)1); b = echo(cast(immutable byte)1); b =

Re: Improving reviewing and scrutiny

2015-02-04 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 4 February 2015 at 23:01:48 UTC, Andrei Alexandrescu wrote: Also I'd like to open discussion with the dlang brass to figure out ways on how to make sure this doesn't happen again in the future. Thanks, Andrei Find out who approved the PRs. Maybe an approver needs to be

Re: Another idiom I wish were gone from phobos/druntime

2015-02-04 Thread Jonathan Marler via Digitalmars-d
On Thursday, 5 February 2015 at 00:35:50 UTC, bearophile wrote: Contracts can be read by tools, and they are part of the function signature. Contracts should be encouraged and increased, not discouraged. Bye, bearophile Not to mention that contracts can be removed by the compiler at

Re: Another idiom I wish were gone from phobos/druntime

2015-02-04 Thread Jonathan Marler via Digitalmars-d
On Thursday, 5 February 2015 at 01:07:56 UTC, Andrei Alexandrescu wrote: On 2/4/15 4:47 PM, deadalnix wrote: 1/ the initial is overly long because the styling is wasteful. void foo() in { ... } body { ... } Is simply one line more than not using contracts. Would introduce an exception

<    1   2   3   4   5   >