On Sunday, 28 May 2017 at 23:49:16 UTC, Brad Roberts wrote:
Is there a mechanism for declaring something pure when it's
built from parts which individually aren't?
string foo(string s)
{
// do something arbitrarily complex with s that doesn't
touch globals or change global state except
On Sunday, May 28, 2017 18:46:22 Brad Roberts via Digitalmars-d-learn wrote:
> Again, of course it's possible to do it wrong. Escape hatches are like
> that. And of course things are being worked on and improved, I'm one of
> the ones that's done a good bit of that at various points in time.
On 5/28/2017 6:46 PM, Brad Roberts via Digitalmars-d-learn wrote:
Here's the bug that I'm digging into today, a clear example of an api
that _should_ be pure, but based on the implementation is rather
difficult for the compiler to infer.
https://issues.dlang.org/show_bug.cgi?id=17442
On 5/28/2017 6:36 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, May 28, 2017 17:53:25 Brad Roberts via Digitalmars-d-learn wrote:
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn
wrote:
On Sunday, May 28, 2017 18:39:02 Brad Roberts via Digitalmars-d-learn wrote:
> On 5/28/2017 6:27 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > There was a whole discussion or 3 is PRs about making malloc pure, and
> > IIRC, it was done and then decided that it wasn't safe to do some for
On 5/28/2017 6:27 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Monday, May 29, 2017 01:01:46 Stefan Koch via Digitalmars-d-learn wrote:
On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote:
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Sunday, May
On Sunday, May 28, 2017 17:53:25 Brad Roberts via Digitalmars-d-learn wrote:
> On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn
wrote:
> >> Is there a mechanism for declaring something pure when it's
On Monday, May 29, 2017 01:01:46 Stefan Koch via Digitalmars-d-learn wrote:
> On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote:
> > On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn
> >
> > wrote:
> >> On Sunday, May 28, 2017 16:49:16 Brad Roberts via
> >>
> >>
On Monday, 29 May 2017 at 01:12:53 UTC, Era Scarecrow wrote:
...
Hmm didn't notice the post had split. Otherwise i wouldn't have
replied... That and thinking about the GC state (outside of
allocating memory)...
On Sunday, 28 May 2017 at 23:49:16 UTC, Brad Roberts wrote:
// do something arbitrarily complex with s that doesn't
touch globals or change global state except possibly state of
the heap or gc
Sounds like the basic definition of pure to me; At least in
regards to D. Memory allocation
On Monday, 29 May 2017 at 01:01:46 UTC, Stefan Koch wrote:
There is
void[] myPureMalloc(uint size) pure @trusted nothrow @nogc
{
import core.stdc.stdlib : malloc;
alias pure_malloc_t = @nogc pure nothrow void* function(size_t
size);
return (cast(pure_malloc_t))(size)[0 .. size];
}
On 5/28/2017 6:01 PM, Stefan Koch via Digitalmars-d-learn wrote:
On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote:
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, May 28, 2017 16:49:16 Brad Roberts via
Digitalmars-d-learn wrote:
Is there a mechanism
On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote:
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Sunday, May 28, 2017 16:49:16 Brad Roberts via
Digitalmars-d-learn wrote:
Is there a mechanism for declaring something pure when it's
built from
parts which
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote:
Is there a mechanism for declaring something pure when it's built from
parts which individually aren't?
string foo(string s)
{
// do
On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote:
> Is there a mechanism for declaring something pure when it's built from
> parts which individually aren't?
>
> string foo(string s)
> {
> // do something arbitrarily complex with s that doesn't touch
> globals or
Is there a mechanism for declaring something pure when it's built from
parts which individually aren't?
string foo(string s)
{
// do something arbitrarily complex with s that doesn't touch
globals or change global state except possibly state of the heap or gc
return s;
}
On Sunday, 28 May 2017 at 22:14:46 UTC, Adam D. Ruppe wrote:
On Sunday, 28 May 2017 at 22:07:12 UTC, helxi wrote:
So I tried using C's EOF but the types aren't compatible since
EOF is probably aliased to -1
The readln docs for D say it returns null on end of file. The
example given is:
On Sunday, 28 May 2017 at 22:07:12 UTC, helxi wrote:
So I tried using C's EOF but the types aren't compatible since
EOF is probably aliased to -1
The readln docs for D say it returns null on end of file. The
example given is:
import std.stdio;
void main()
{
string line;
while
Hello, I just wrote a mock-up of Unix's $cat. However unlike the
actual $cat, when input interrupt (Cntrl+D) is pressed the
following program does not stop.
So I tried using C's EOF but the types aren't compatible since
EOF is probably aliased to -1
//...
if (args.length < 2)
{
On Sunday, 28 May 2017 at 20:06:42 UTC, piotrklos wrote:
I need to perform an action, in multiple separate functions, if
scope exits with an exception. The trouble is I don't want to
litter my code with scope(failure) everywhere. I already create
an instance of a struct at each location, with
I need to perform an action, in multiple separate functions, if
scope exits with an exception. The trouble is I don't want to
litter my code with scope(failure) everywhere. I already create
an instance of a struct at each location, with the sole purpose
of doing things at the end of scope.
So
On Sunday, 28 May 2017 at 15:00:30 UTC, Ali Çehreli wrote:
On 05/28/2017 07:55 AM, Petras wrote:
> Hi, I am learning how to use readf to read integers. I follow
the
> example in https://dlang.org/library/std/stdio/readf.html
>
> The sample code use readf in following way
> readf!" %d"(a);
On 05/28/2017 03:30 PM, Mike Wey wrote:
On 05/28/2017 03:20 PM, Mike Wey wrote:
On 05/27/2017 11:42 PM, greatsam4sure wrote:
rdmd Build.d fail on windows with dmd 2.074.0,dmd 2.073.0.
it says std.file.FileException@std\file.d(814)gtkd2.obj:The system
cannot find the file specifield.
I have
On 05/28/2017 07:55 AM, Petras wrote:
> Hi, I am learning how to use readf to read integers. I follow the
> example in https://dlang.org/library/std/stdio/readf.html
>
> The sample code use readf in following way
> readf!" %d"(a);
Providing the format string as a template argument and being
Hi, I am learning how to use readf to read integers. I follow the
example in https://dlang.org/library/std/stdio/readf.html
The sample code use readf in following way
readf!" %d"(a);
It works when I use dmd 2.074. However, I got compile error when
I switch to ldc2
On 05/28/2017 03:20 PM, Mike Wey wrote:
On 05/27/2017 11:42 PM, greatsam4sure wrote:
rdmd Build.d fail on windows with dmd 2.074.0,dmd 2.073.0.
it says std.file.FileException@std\file.d(814)gtkd2.obj:The system
cannot find the file specifield.
I have to use dmd 2.071.0 to build it
I will
On 05/27/2017 11:42 PM, greatsam4sure wrote:
rdmd Build.d fail on windows with dmd 2.074.0,dmd 2.073.0.
it says std.file.FileException@std\file.d(814)gtkd2.obj:The system
cannot find the file specifield.
I have to use dmd 2.071.0 to build it
I will appreciate your help
sorry for the mistake
On Sunday, 28 May 2017 at 04:05:47 UTC, Softwarez wrote:
Hi can anyone please help me how to get screenshot on Windows
using D, because all the other threads are using linux to get
screenshot.
In the same way you'd do it in C.
Here is a more convoluted D example in the form of a program I
28 matches
Mail list logo