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
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 { }
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
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
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
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
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.
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
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
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
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
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
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
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:
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
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.
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
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
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
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 (
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__
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
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
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
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
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
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
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 (
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
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
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
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
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
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
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:)
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
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?
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
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
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
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
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?
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
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
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
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
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.
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
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
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,
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
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
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
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,
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
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
Do the various D compilers use multiple passes to handle forward
references or some other technique?
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.
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
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) {
}
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
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
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:
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
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
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
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:
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
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
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),
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
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?
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
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
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
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
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
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
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
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() {
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
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
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
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.
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.
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
}
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
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
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 :)
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
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)`
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
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
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
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
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
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 =
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
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
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
201 - 300 of 456 matches
Mail list logo