On 17.07.21 00:27, H. S. Teoh wrote:
Hmm, OK. Not sure why .array isn't being inferred as unique... but yeah,
you probably have to resort to using @trusted with .assumeUnique.
In addition to `pure`, you also need a const/immutable input and a
mutable output, so that the output cannot be a slic
On Friday, 16 July 2021 at 20:04:21 UTC, jfondren wrote:
On Friday, 16 July 2021 at 19:25:32 UTC, btiffin wrote:
Using gdc-11 and Seamonkey.
https://rosettacode.org/wiki/Hello_world/Web_server#D does not
compile.
The `while` as you noted is wrong. The server also doesn't turn
REUSEADDR on f
On 7/16/21 3:21 PM, Dennis wrote:
> But `pure` is no silver bullet:
Agreed. I occasionally struggle with these issues as well. Here is a
related one:
import std;
void foo(const int[] a) {
auto b = a.array;
b.front = 42;
// Error: cannot modify `const` expression `front(b)`
}
I think t
On Fri, Jul 16, 2021 at 10:23:31PM +, Dennis via Digitalmars-d-learn wrote:
> On Friday, 16 July 2021 at 20:45:11 UTC, H. S. Teoh wrote:
> > Have you tried `pure`?
>
> The code in question is all `@safe pure nothrow`.
Hmm, OK. Not sure why .array isn't being inferred as unique... but yeah,
yo
On Friday, 16 July 2021 at 20:45:11 UTC, H. S. Teoh wrote:
Have you tried `pure`?
The code in question is all `@safe pure nothrow`.
On Friday, 16 July 2021 at 20:39:41 UTC, Ali Çehreli wrote:
So to me, newly created data should be mutable for the most
usability.
It's clear that I stripped away too much context with the toy
examples, so let me try to add some back. I don't like forcing
the use of `immutable` in general, bu
On Fri, Jul 16, 2021 at 08:19:32PM +, Dennis via Digitalmars-d-learn wrote:
[...]
> ```D
> immutable(int)[] positive(int[] input) @safe
> {
> return input.filter!(x => x > 0).array;
> }
> ```
[...]
> I could make another primitive (`iarraySort`), but I wonder if there
> are more convenient
On 7/16/21 1:19 PM, Dennis wrote:
> I like passing around immutable data
I think the D community needs to talk more about guidelines around
'immutable'. We don't... And I lack a complete understanding myself. :)
To me, 'immutable' is a demand of the user from the provider that the
data will
I like passing around immutable data, but I don't like creating
it. Here are some toy examples to illustrate:
```D
immutable(int)[] positive(int[] input) @safe
{
return input.filter!(x => x > 0).array;
}
```
Error: cannot implicitly convert expression
`array(filter(input))` of type `int[]`
On Friday, 16 July 2021 at 20:04:21 UTC, jfondren wrote:
static const greeting = q"EOF
Or just `immutable greeting = ...`
On Friday, 16 July 2021 at 19:25:32 UTC, btiffin wrote:
Using gdc-11 and Seamonkey.
https://rosettacode.org/wiki/Hello_world/Web_server#D does not
compile.
The `while` as you noted is wrong. The server also doesn't turn
REUSEADDR on for the server socket, so this will be very annoying
to te
Using gdc-11 and Seamonkey.
https://rosettacode.org/wiki/Hello_world/Web_server#D does not
compile.
```d
prompt$ gdc-11 helloServer.d
helloServer.d:12:29: error: cannot cast expression currSock =
listener.accept() of type std.socket.Socket to bool
12 | while(cast(bool)(currSock = listen
On Fri, Jul 16, 2021 at 04:54:18PM +, Scotpip via Digitalmars-d-learn wrote:
[...]
> I simply need a fast binary serialisation lib to read and write a
> large list of structs to local disk - it's not for inter-app
> communication. The struct is simple and only contains primitive D data
> types.
On Friday, 16 July 2021 at 17:14:12 UTC, Mike Parker wrote:
I haven't had occasion to make use of any serialization
libraries myself, but you can start here:
https://wiki.dlang.org/Serialization_Libraries
Also:
https://code.dlang.org/search?q=serialization
On Friday, 16 July 2021 at 16:54:18 UTC, Scotpip wrote:
Yup - I have it running now but the code does seem to be a bit
neglected and I'm seeing a depreciation warning too. I chose it
because it's much the most downloaded serialisation package and
is used in a couple of other popular packages.
On Friday, 16 July 2021 at 16:44:31 UTC, Scotpip wrote:
Again, if this helps anyone my current setup is to have a
single main() in app.d. I changed the main() in my sandboxes to
runSandbox(), and I import and run from app.d rather than
directly. Or with a couple of keystrokes I can switch to
On Friday, 16 July 2021 at 16:42:50 UTC, Mike Parker wrote:
I did encounter some missing symbols, though (`ntohl` and
`ntohs`) as msgpack-d isn't linking with Ws2-32.lib. I added
`pragma(lib, "Ws2_32")` to the top of the file to resolve it.
(And I filed an issue:
https://github.com/msgpack/m
On Friday, 16 July 2021 at 15:42:32 UTC, rikki cattermole wrote:
``$ dub build`` inside of ``myproject`` should work.
Thanks - that was helpful.
For anyone else with this issue I've figured out what went wrong.
I had more than one main() function in the project - I was using
the others as
On Friday, 16 July 2021 at 15:31:49 UTC, Scotpip wrote:
I'm completely stuck till I can get this fixed, so any help
would be very much appreciated!
I used the example from the readme at:
https://code.dlang.org/packages/msgpack-d
which I pasted into the generated `app.d`. And all the comma
On 17/07/2021 3:31 AM, Scotpip wrote:
In dub.sdl I see: ```dependency "msgpack-d" version="~>1.0.3"```
In dub.selections.json I see:
```
{
"fileVersion": 1,
"versions": {
"msgpack-d": "1.0.3"
}
}
```
Okay, its been added to your dub project. So far so good.
When I t
Another newbie question I'm afraid.
Trying to import and use my first package from the registry.
I installed D from the Windows dmd-2.097.0.exe
I created the project with ```$ dub init myproject```
In the project root I've run:
```
$ dub add msgpack-d
Adding dependency msgpack-d ~>1.0.3
```
On Friday, 16 July 2021 at 08:22:14 UTC, RazvanN wrote:
On Monday, 12 July 2021 at 23:57:37 UTC, Scotpip wrote:
Hi guys
Just installed the DMD 2.097.0 .exe download for Windows on my
64 bit Win 10 workstation.
[...]
PR: https://github.com/dlang/installer/pull/484
Good work!
On Thursday, 15 July 2021 at 15:39:59 UTC, Tejas wrote:
On Thursday, 15 July 2021 at 13:28:19 UTC, wjoe wrote:
On Thursday, 15 July 2021 at 12:09:20 UTC, Tejas wrote:
[...]
The only way, for me, to explain the error message ```opIndex
isn't an lvalue and can't be modified.``` for ```i[1]++``
On Monday, 12 July 2021 at 23:57:37 UTC, Scotpip wrote:
Hi guys
Just installed the DMD 2.097.0 .exe download for Windows on my
64 bit Win 10 workstation.
[...]
PR: https://github.com/dlang/installer/pull/484
24 matches
Mail list logo