Re: -preview=in deprecation warning

2023-04-20 Thread Jack Applegame via Digitalmars-d-learn
On Thursday, 20 April 2023 at 09:41:13 UTC, Dennis wrote: On Thursday, 20 April 2023 at 09:14:48 UTC, Jack Applegame wrote: Can anyone help me get rid of this depreciation? Annotate `getFoo` with `return scope`: ```d struct Foo { string foo; string getFoo() return scope const

-preview=in deprecation warning

2023-04-20 Thread Jack Applegame via Digitalmars-d-learn
Can anyone help me get rid of this depreciation? ```d struct Foo { string foo; string getFoo() const @safe { return foo; } } size_t bar(in Foo foo) @safe { return foo.getFoo().length; } void main() { Foo("hello").bar().writeln(); } ``` ```sh $ ldc2 -preview=in

Re: A new Tree-Sitter Grammar for D

2022-10-27 Thread Jack Applegame via Digitalmars-d-announce
On Monday, 17 October 2022 at 05:21:10 UTC, Garrett D'Amore wrote: I'm happy to announce that I've created what I believe is a complete, or at least very nearly so, Tree-Sitter grammar for D. You can find it at https://github.com/gdamore/tree-sitter-d What do you think? If I don't want to

Re: print ubyte[] as (ascii) string

2022-01-01 Thread Jack Applegame via Digitalmars-d-learn
On Thursday, 30 December 2021 at 18:07:15 UTC, eugene wrote: On Thursday, 30 December 2021 at 17:52:20 UTC, eugene wrote: much better than my initial You can also write ```d auto s = cast(string)b; // or cast(string)(b) ``` instead of ```d char[] s = cast(char[])b[0 .. $]; ```

Re: function parameters: is it possible to pass byref ... while being optional at the same time ?

2021-07-17 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 17 July 2021 at 20:49:58 UTC, someone wrote: The following gives me a compiler error when I add the second parameter: is not an lvalue and cannot be modified ```d public bool add( ref classTickerID robjTickerID, ref classExchanges robjExchanges = null /// needing this

Re: How to disable assigning a value to a property?

2021-07-06 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 6 July 2021 at 12:33:20 UTC, Adam D Ruppe wrote: The language always allows `a = b;` to be rewritten as `a(b);`. And that's sad. It should happen for properties only.

Re: How to disable assigning a value to a property?

2021-07-06 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 6 July 2021 at 10:25:28 UTC, Dennis wrote: We're [still awaiting formal assessment on dip1038](https://forum.dlang.org/thread/sojvxakgruzfvbigz...@forum.dlang.org), but if that gets in, you can mark `clock` or `Field` `@nodicard`. Otherwise I don't know of a way. Yes, it would

Re: How to disable assigning a value to a property?

2021-07-06 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 6 July 2021 at 10:24:45 UTC, drug wrote: Something like using different types for arguments in `Register.clock` and `Field.opAssign`? I've been thinking about it. Unfortunately, this is not always convenient.

How to disable assigning a value to a property?

2021-07-06 Thread Jack Applegame via Digitalmars-d-learn
Code: ```d import std.stdio; struct Field { void opAssign(int a) { writefln("Field.opAssign(%s)", a); } } struct Register { Field clock(int a) { writefln("Register.clock(%s)", a); return Field(); } } void main() { Register register;

Re: Strange error

2021-03-21 Thread Jack Applegame via Digitalmars-d-learn
On Sunday, 21 March 2021 at 08:45:19 UTC, Imperatorn wrote: On Sunday, 21 March 2021 at 07:18:10 UTC, Jack Applegame wrote: Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{ void function() func1; void

Strange error

2021-03-21 Thread Jack Applegame via Digitalmars-d-learn
Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{ void function() func1; void function() func2; } void noth(Sample smpl)() { smpl.func1(); // Error: expression __lambda1 is not a valid template value

Re: Truly algebraic Variant and Nullable

2020-11-15 Thread Jack Applegame via Digitalmars-d-announce
On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Nullable is defined as ``` alias Nullable(T...) = Variant!(typeof(null), T); ``` Variant and Nullable with zero types are allowed. `void` type is supported.

static alias this and if/do/while/for

2020-10-22 Thread Jack Applegame via Digitalmars-d-learn
There is a funny feature (or bug) in the D language: static alias this and static operator overloading. For example interface Foo { static { int value; void opAssign(int v) { value = v; } int get() { return value; } alias get this; } } Now we can use

Arrays and non-copyable elements

2020-06-07 Thread Jack Applegame via Digitalmars-d-learn
I think it should compile. ``` struct NonCopyable { int a; this(this) @disable; } void main() { NonCopyable[] arr = [NonCopyable(1), NonCopyable(2)]; // ok arr ~= NonCopyable(3); // fails } ```

Re: Should it compile?

2020-06-07 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 6 June 2020 at 11:58:06 UTC, Basile B. wrote: maybe it shouldn't but then with another message, for example Error, cannot `void` initialize a `const` declaration. since that makes very little sense, at least as a local variable. (as a member, this can be initialized in a

Re: Should it compile?

2020-06-07 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 6 June 2020 at 12:02:03 UTC, MoonlightSentinel wrote: On Saturday, 6 June 2020 at 08:55:20 UTC, Jack Applegame wrote: Should it compile? No, moveEmplace just sees a const reference and doesn't know that a is void-initialized. Actually, it knows. Because moveEmplace assumes

Should it compile?

2020-06-06 Thread Jack Applegame via Digitalmars-d-learn
Should it compile? ```d import std.algorithm.mutation; void main() { const char a = void; const char b ='b'; moveEmplace(b, a); // mutation.d: Error: cannot modify const expression target assert(a == 'b'); } ``` I think, it should.

Re: Command line calculator in D

2020-05-14 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 6 May 2020 at 11:47:55 UTC, Alireza SN wrote: I was learning about an algorithm called 'Pratt Parser' and decided to write a cli calculator with it. Here is the link if you want to check it out: https://github.com/TheWeirdDev/Calcool Feel free to point out any mistakes i have

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 11 May 2020 at 13:12:37 UTC, Simen Kjærås wrote: Filed here: https://issues.dlang.org/show_bug.cgi?id=20821 Thanks.

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 11 May 2020 at 12:30:22 UTC, Adam D. Ruppe wrote: UFCS is only defined to work with global scope functions. A restricted import (module : symbol, symbols) puts things in local scope so ufcs doesn't apply. But in this case the error should be displayed for lines 4 and 5, not 11.

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
And the first example still doesn't compile: ``` struct Range(R) { import std.array : empty, front, popFront; R range; bool empty() const { return range.empty; } auto front() const { return range.front; } void popFront() { range.popFront(); } } void main() { auto rng

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 11 May 2020 at 12:20:06 UTC, Jack Applegame wrote: assert(rng.front == 1); Damn! I made a typo. It must be: assert(rng.front == '1') So the second example works fine.

Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
Why doesn't it compile? ``` struct Range(R) { import std.array : empty, front, popFront; R range; bool empty() const { return range.empty; } auto front() const { return range.front; } void popFront() { range.popFront(); } } void main() { auto rng = Range!string("1234");

Challenge

2020-05-09 Thread Jack Applegame via Digitalmars-d-learn
I recently came across an interesting exercise. Given a series of positive numbers, each of which belongs to the set { 2^^i * 3^^j * 5^^k | i, j, k ≥ 0 }. The series is ordered in ascending order. The beginning looks like this: { 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, ... }

Re: dlang.ru is updated

2019-05-18 Thread Jack Applegame via Digitalmars-d-announce
Unfortunately, now (and the last few years) dlang.ru is pretty useless.

Re: dlang.ru is updated

2019-05-18 Thread Jack Applegame via Digitalmars-d-announce
On Saturday, 18 May 2019 at 06:26:10 UTC, Suliman wrote: On Saturday, 18 May 2019 at 03:01:33 UTC, 9il wrote: On Thursday, 16 May 2019 at 12:25:52 UTC, Suliman wrote: After 2 years dlang.ru was update. Content did not change. Main improves was is technology stack and design (still not

Re: Deep nesting vs early returns

2018-10-04 Thread Jack Applegame via Digitalmars-d
On Thursday, 4 October 2018 at 06:43:02 UTC, Gopan wrote: Certain people recommend that there be only one return statement (usually at the end) from a function. The said advantage is that, in a maintenance code, if you later want to do something before returning, you can add it just above the

Confusing TLS

2018-03-13 Thread Jack Applegame via Digitalmars-d
Code: import std.stdio; import core.thread; import core.time; auto arr = new ubyte[1]; // THIS SHOULD NOT COMPILE int main(string[] args) { new Thread({ arr[0]++; }).start(); new Thread({ arr[0]++; }).start(); Thread.sleep(1.seconds); writefln("arr[0]

Re: How to extract the AA type?

2017-12-13 Thread Jack Applegame via Digitalmars-d
auto foo(T: V[K], V, K)(T t) { CopyConstness!(T, V[K]) aa = t; return aa; } https://run.dlang.io/is/LSMa5C

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-13 Thread Jack Applegame via Digitalmars-d
On Friday, 13 October 2017 at 10:55:24 UTC, rikki cattermole wrote: On 13/10/2017 11:40 AM, Jack Applegame wrote: Please create an issue for this Done. https://issues.dlang.org/show_bug.cgi?id=17897 To anybody else, the poster is willing to pay a token to have this fixed. [0]

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-13 Thread Jack Applegame via Digitalmars-d-learn
On Friday, 13 October 2017 at 12:03:55 UTC, Dgame wrote: Interesting. If you remove the CTor in Foo it works again. If you remove DTor it works again too. :)

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-13 Thread Jack Applegame via Digitalmars-d-learn
On Friday, 13 October 2017 at 11:21:48 UTC, Biotronic wrote: BountySource[2] lets you do basically exactly that. My experience says that BountySource almost doesn't help.

Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-13 Thread Jack Applegame via Digitalmars-d
Sorry, I mistakenly placed my post in the wrong section. Consider, please: https://forum.dlang.org/thread/oxucajbsjbsuraqtn...@forum.dlang.org

Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-13 Thread Jack Applegame via Digitalmars-d-learn
If you don't want to get the great PITA, never create temporary objects in function parameters. I recently spent a whole day digging through my reference counted containers library. But nasty bug was not there, but in the compiler. Look at this: https://glot.io/snippets/eui2l8ov0r Result:

Re: gdc is in

2017-10-08 Thread Jack Applegame via Digitalmars-d
On Sunday, 8 October 2017 at 08:38:15 UTC, Iain Buclaw wrote: Donating for the upkeep of our infrastructure is also welcome. ;-) How to do this?

Re: What the hell is wrong with D?

2017-09-20 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 19:54:02 UTC, Steven Schveighoffer wrote: On 9/19/17 1:40 PM, EntangledQuanta wrote: The first returns x + w/2 and the second returns w/2! Did you mean (x + w) / 2 or x + (w / 2)? Stop being ambiguous! -Steve The best answer. :D

Re: dlang-requetst v0.5.3 released

2017-09-13 Thread Jack Applegame via Digitalmars-d-announce
Thanks!

Re: LDC, ARM: unnecessary default initialization

2017-08-19 Thread Jack Applegame via Digitalmars-d
On Friday, 18 August 2017 at 17:28:38 UTC, kinke wrote: On Friday, 18 August 2017 at 12:09:04 UTC, kinke wrote: On Friday, 18 August 2017 at 09:42:25 UTC, Jack Applegame wrote: For some reason, the LDC default initializes the structure, even if initialization of all its members is specified as

LDC, ARM: unnecessary default initialization

2017-08-18 Thread Jack Applegame via Digitalmars-d
I explore the possibility of using D for bare metal ARM programming. For some reason, the LDC default initializes the structure, even if initialization of all its members is specified as void. I believe that this is wrong. test.d module test; import

Re: dlang-requetst: openssl 1.1 compatible release

2017-08-05 Thread Jack Applegame via Digitalmars-d-announce
On Friday, 4 August 2017 at 18:28:23 UTC, ikod wrote: On Friday, 4 August 2017 at 17:06:16 UTC, Jack Applegame wrote: Does dlang-requests support binding interface for outgoing connection, like curl --interface option? No, but this can be done. It would be nice if you post issue on github.

Re: dlang-requetst: openssl 1.1 compatible release

2017-08-04 Thread Jack Applegame via Digitalmars-d-announce
On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote: Hello, Since version 0.5.0 dlang-requests has become compatible with both 1.0.x and 1.1.x versions of openssl library. Please try and report any issues on github. Thanks! dlang-requests is HTTP/FTP client library, inspired by

Re: Appending static arrays

2017-07-18 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 12:39:01 UTC, Stefan Koch wrote: whhhahhh template bloat Yes, and also very slow. :)

Re: Appending static arrays

2017-07-18 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 17 July 2017 at 17:38:23 UTC, Nordlöw wrote: I'm want to define a specialization of `append()` that takes only static arrays as inputs and returns a static array being the sum of the lengths of the inputs. Have anybody already implemented this? If not, I'm specifically interested

Re: Static array with parameter based size?

2017-07-12 Thread Jack Applegame via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 05:45:13 UTC, Miguel L wrote: Also what is it possible in D to write a function that accepts an static array of any size? void foo(size_t N)(ref int[N] arr) { ... } int[10] arr; foo(arr);

Re: Released vibe-core 1.0.0 and vibe.d 0.8.0

2017-07-11 Thread Jack Applegame via Digitalmars-d-announce
slightly reduced /+ dub.json: { "name": "test", "versions": ["VibeManualMemoryManagement"], "dependencies": { "vibe-d": "~>0.8.0" } } +/ module main; import std.conv; import std.stdio;

Re: Released vibe-core 1.0.0 and vibe.d 0.8.0

2017-07-11 Thread Jack Applegame via Digitalmars-d-announce
Many thanks! https requests with manual memory management leads to assertion. DMD64 D Compiler v2.074.1 DUB version 1.3.0 Linux x86_64 Test case: /+ dub.json: { "name": "test", "versions": ["VibeManualMemoryManagement"], "dependencies":

Re: Move construction from !is(T == typeof(this))

2017-04-25 Thread Jack Applegame via Digitalmars-d
On Tuesday, 25 April 2017 at 08:53:22 UTC, Stanislav Blinov wrote: On Tuesday, 25 April 2017 at 07:58:43 UTC, Jack Applegame wrote: On Monday, 24 April 2017 at 18:48:00 UTC, Stanislav Blinov wrote: Suddenly, we can't copy the pointer, or at least make a shallow copy of it, without violating

Re: Move construction from !is(T == typeof(this))

2017-04-25 Thread Jack Applegame via Digitalmars-d
On Monday, 24 April 2017 at 18:48:00 UTC, Stanislav Blinov wrote: Suddenly, we can't copy the pointer, or at least make a shallow copy of it, without violating const, and the latter is UB. Because transitive const/immutable is shit. And that shit had to introduce another shit - Rebindable. D

Re: Need help

2017-03-16 Thread Jack Applegame via Digitalmars-d-announce
On Thursday, 16 March 2017 at 07:54:48 UTC, Jonathan M Davis wrote: Yes, though I'd generally try in the main newsgroup first. Regardless, the biggest thing is to make sure that it's in bugzilla. That often is not sufficient, but without that, the bug is in serious risk of being forgotten, and

Re: Need help

2017-03-16 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 15 March 2017 at 18:02:13 UTC, Daniel Kozák wrote: V Wed, 15 Mar 2017 12:25:04 + Jack Applegame via Digitalmars-d-announce <digitalmars-d-announce@puremagic.com> napsáno: On Wednesday, 15 March 2017 at 11:46:26 UTC, Daniel Kozák wrote: > problem is with this line:

Re: Need help

2017-03-15 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 15 March 2017 at 11:46:26 UTC, Daniel Kozák wrote: problem is with this line: https://github.com/dlang/dmd/blob/v2.073.2/src/clone.d#L1014 It run semantic before alias is add https://github.com/dlang/dmd/blob/v2.073.2/src/clone.d#L1131 Great! But I have no idea what to do next.

Re: Need help

2017-03-15 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 15 March 2017 at 11:09:10 UTC, Jonathan M Davis wrote: I'm inclined to agree with David on this one, but I really don't want to argue about it. Just remember that this newsgroup is intended for announcements that the wider D community would be interested in and that communication

Re: Need help

2017-03-15 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 15 March 2017 at 10:04:50 UTC, rikki cattermole wrote: Oh relax, its a freelance job advertisement as well (payment for bug to be fixed). If that wasn't there then yeah not appropriate. But its there, so I say it was a good place :) Exactly. And besides, it is actually a donation

Re: Need help

2017-03-15 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 15 March 2017 at 09:27:26 UTC, Daniel Kozák wrote: Yes, but you should put this to general forum, not to announcement I tried. Everyone is talking about problems with memory management, but nobody cares about bugs in such fundamental things as the destructors. Apparently it's

Re: Need help

2017-03-15 Thread Jack Applegame via Digitalmars-d-announce
On Wednesday, 15 March 2017 at 08:52:03 UTC, David Nadlinger wrote: This is a forum for announcements of general interest. Please take that into consideration before posting here. Thanks. — David I think that fixing such bugs is quite general interest. I'm not asking to do enhancement

Need help

2017-03-15 Thread Jack Applegame via Digitalmars-d-announce
Dear developers. I need help fixing issue #17257 (https://issues.dlang.org/show_bug.cgi?id=17257) and related bug (https://forum.dlang.org/post/zpxzbctiijfhjujsz...@forum.dlang.org). I can't fix it myself, because know almost nothing about the internals of the compiler. But I'm willing to pay

Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
On Tuesday, 14 March 2017 at 14:33:49 UTC, John Colvin wrote: bug report? https://issues.dlang.org/show_bug.cgi?id=17257

Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
This is completely unacceptable: DPaste(https://dpaste.dzfl.pl/f54f578c4ec9) import std.stdio; import std.string; import std.experimental.allocator; import std.experimental.allocator.mallocator : Mallocator; struct Bar(E) { E* ptr = null; void allocate(int m) { ptr =

Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
On Tuesday, 14 March 2017 at 12:44:16 UTC, Jack Applegame wrote: Workaround: Avoid reflection in the destructor. Do reflection in normal function and then call it from destructor. This doesn't work - https://dpaste.dzfl.pl/5a1d93f7a277 Call from destructor changes compiler behavior. This is

Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
I'm trying to write reference counted dynamic array and encountered a trouble with compile time reflection at recursive template instantiation. for dynamic arrays (and AA too) it is normal to use recursive declarations: struct S { S[] arr; } struct S { Array!S arr; } Look at this

Re: Bug or feature?

2017-03-14 Thread Jack Applegame via Digitalmars-d
Sorry, right link - https://forum.dlang.org/thread/okbzqkjijuwvmvstj...@forum.dlang.org

Bug or feature?

2017-03-14 Thread Jack Applegame via Digitalmars-d
https://forum.dlang.org/post/yjddbxzqzvmlvqrht...@forum.dlang.org

Re: Recursive template instantiation

2017-03-13 Thread Jack Applegame via Digitalmars-d-learn
Is this a bug?

Recursive template instantiation

2017-03-13 Thread Jack Applegame via Digitalmars-d-learn
I'm pretty sure that this code should compile (https://dpaste.dzfl.pl/cf1e1ee6ef4b): struct A(T) { ~this() { char[T.sizeof] data; } } struct B(T) { A!T foo; } struct C { B!C bar; } void main() { C c; } But it doesn't: /d300/f416.d(3): Error: struct f416.C no size

Re: Cconditional expression in return statement. Bug?

2017-03-08 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 7 March 2017 at 16:00:54 UTC, kinke wrote: Definitely a very bad bug. It works too if you mark `fun()` as nothrow. Please file a DMD issue. https://issues.dlang.org/show_bug.cgi?id=17246

Cconditional expression in return statement. Bug?

2017-03-07 Thread Jack Applegame via Digitalmars-d-learn
Code (https://dpaste.dzfl.pl/8e7a9c380e99): import std.stdio; struct Foo { int val; this(int val) { writefln("%s.this(int)", val); this.val = val; } this(this) { writefln("%s.this(this)", val); this.val = val; } ~this() {

Re: Database of practicality will be an important factor for development of D language in the future

2017-02-06 Thread Jack Applegame via Digitalmars-d
On Thursday, 2 February 2017 at 13:28:48 UTC, Shachar Shemesh wrote: On 02/02/17 14:50, Adam D. Ruppe wrote: On Thursday, 2 February 2017 at 05:33:57 UTC, FrankLike wrote: For example, I want to do the execution of stored procedure for MSSql、MySQL database. I found in Mysql-d, Mysql-Native,

Re: Does vibe.d support setting cookies?

2017-02-01 Thread Jack Applegame via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 14:09:41 UTC, aberba wrote: I can't find it. Like set_cookie() in php. Yes, it does. http://vibed.org/api/vibe.http.common/HTTPResponse.cookies

Re: Another bug?

2017-01-30 Thread Jack Applegame via Digitalmars-d-learn
bug report: https://issues.dlang.org/show_bug.cgi?id=17128

Re: Another bug?

2017-01-30 Thread Jack Applegame via Digitalmars-d-learn
WORKAROUND: import std.stdio; struct Foo { int val = 0; ~this() { writefln("destruct %s", val); } } void bar(ARGS...)() { struct Tuple { ARGS args; alias args this; } Tuple args; args[0].val = 1; writefln("val = %s", args[0].val); }

Another bug?

2017-01-30 Thread Jack Applegame via Digitalmars-d-learn
Code: import std.stdio; struct Foo { int val = 0; ~this() { writefln("destruct %s", val); } } void bar(ARGS...)() { ARGS args; args[0].val = 1; writefln("val = %s", args[0].val); } void main() { bar!Foo(); } Excpected output: val = 1 destruct 1 But

Re: Parsing a UTF-16LE file line by line, BUG?

2017-01-26 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 16 January 2017 at 14:47:23 UTC, Era Scarecrow wrote: static char[1024*4] buffer; //4k reusable buffer, NOT thread safe Maybe I'm wrong, but I think it's thread safe. Because static mutable non-shared variables are stored in TLS.

Re: It is still not possible to use D on debian/ubuntu

2017-01-14 Thread Jack Applegame via Digitalmars-d
On Saturday, 14 January 2017 at 18:41:21 UTC, Russel Winder wrote: On Sat, 2017-01-14 at 17:28 +, Elronnd via Digitalmars-d wrote: On Friday, 13 January 2017 at 11:50:25 UTC, Russel Winder wrote: > LDC which is packaged by both Debian and Fedora is the > only practically usable D compiler

Re: How to initialize a associative array?

2016-12-25 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui wrote: I tried this: immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3, 'P':4]; And got a "non-constant expression" error (with or without 'immutable'). What's the correct way? This works: void main() { immutable

Re: Red Hat's issues in considering the D language

2016-12-22 Thread Jack Applegame via Digitalmars-d
On Thursday, 22 December 2016 at 08:33:55 UTC, Daniel Kozák wrote: ? I am on fedora and I have dmd, so it is not true :P Dejan Lekic via Digitalmars-d napsal St, pro 21, 2016 v 6∶36 : On Wednesday, 21 December 2016 at 16:41:56 UTC, hardreset wrote: Moving the

Re: How do we accelerate the development of precise GC, RC and so on?

2016-11-24 Thread Jack Applegame via Digitalmars-d
So, who wants to do a good deed and make some money? We can create an issue and start fundraising on Bountysource. We can also donate to the D Language Foundation, but I personally would like to see the funds were used to develop precise GC and DIP74 (https://wiki.dlang.org/DIP74).

How do we accelerate the development of precise GC, RC and so on?

2016-11-22 Thread Jack Applegame via Digitalmars-d
We look forward to sane GC over the years. How do we accelerate the development of precise GC, RC and so on? Maybe we should organize a fundraiser on Kickstarter or somewhere else? I'm not ready to write precise GC, but I'm willing to donate to those who are ready.

Re: Const/Immutable Slicing Syntax

2016-11-22 Thread Jack Applegame via Digitalmars-d-learn
cast(const) x[]; cast(immutable) x[];

Challenge on Russian Stack Overflow

2016-11-11 Thread Jack Applegame via Digitalmars-d
I found funny (from my point of view) challenge in Russian Stack Overflow. Any language accepted. You need to make the loop for (int x=0; x<3; ++x) {} endless. Rules: - you can't modify the loop's code itself; - you can't modify the loop's variable inside the body of loop; - you can't wrap

Re: New (second) release candidate vibe.d 0.7.30-rc.2

2016-10-16 Thread Jack Applegame via Digitalmars-d-announce
On Friday, 14 October 2016 at 19:57:09 UTC, Sönke Ludwig wrote: https://github.com/rejectedsoftware/vibe.d/commit/ab1ac33c564ad8d593104e30cc93eb1779c88d4a Plus some regression fixes for issues that got introduced since the last alpha release (not mentioned in the change log). The release has

Re: Release candidate vibe.d 0.7.30-rc.1

2016-10-03 Thread Jack Applegame via Digitalmars-d-announce
On Thursday, 29 September 2016 at 13:44:53 UTC, Sönke Ludwig wrote: If no new issues come up, the 0.7.30 release is scheduled for the 9th of October. Please consider https://github.com/rejectedsoftware/vibe.d/issues/1583

D Language Foundation

2016-09-30 Thread Jack Applegame via Digitalmars-d
Is there a way to donate to the D Language Foundation?

Re: Beta D 2.071.2-b2

2016-08-30 Thread Jack Applegame via Digitalmars-d-announce
On Tuesday, 9 August 2016 at 15:37:27 UTC, Martin Nowak wrote: Second beta for the 2.071.2 release. This fixes Issue 15780, 16085, and 16348. More import/lookup fixes upcoming. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.071.2.html Please report any bugs at

Re: InterlockedIncrement, InterlockedCompareExchange, etc

2016-08-28 Thread Jack Applegame via Digitalmars-d-learn
On Sunday, 28 August 2016 at 20:38:30 UTC, Lodovico Giaretta wrote: On Sunday, 28 August 2016 at 19:53:51 UTC, Illuminati wrote: What are the D equivalents to these types of functions? I do not see anything in core.atomic that can accomplish this. I have tried to include

mutable destructor? WAT???

2016-08-28 Thread Jack Applegame via Digitalmars-d-learn
object.destroy doesn't want to destroy const structure with destructor: struct T { ~this() {} } void foo_t(ref T t) { destroy(t); // works } void foo_ct(ref const T t) { destroy(t); // Error: mutable method T.~this is not callable using a const object } Mutable destructor?

Re: union mutability

2016-08-25 Thread Jack Applegame via Digitalmars-d-learn
On Thursday, 25 August 2016 at 19:19:49 UTC, Jonathan M Davis wrote: Why? I don't know exactly what that PR is supposed to do, but std.datetime uses immutable time zone objects, and if that PR made it so that you couldn't have an immutable instance of a class, then it would have failed the

Re: union mutability

2016-08-25 Thread Jack Applegame via Digitalmars-d-learn
Also I hate Rebindable.

Re: union mutability

2016-08-25 Thread Jack Applegame via Digitalmars-d-learn
On Thursday, 25 August 2016 at 17:01:40 UTC, Meta wrote: This should be fixed pretty soon: https://github.com/dlang/dmd/pull/5940 Bye-bye immutable classes. :'(

union mutability

2016-08-25 Thread Jack Applegame via Digitalmars-d-learn
Code: union A { immutable int f; } union B { immutable int f; int e; } void main() { A a = A(1); //a = A(2); // a.f is immutable, fails to compile as expected B b = B(1); b = B(2); // compiles!!! } It turns out that if the union contains at least one

Re: Metaprogramming, generate argument list.

2016-08-24 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 23 August 2016 at 21:14:01 UTC, ciechowoj wrote: This is a bit strange, as the local variables aren't known either and they seem to work. I do not want to get the address, rather an alias to `` expression. D doesn't accept aliases to expressions, only symbols and literals. Spec:

Re: Metaprogramming, generate argument list.

2016-08-23 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 22 August 2016 at 22:01:51 UTC, ciechowoj wrote: Is it possible to generate an argument list that contains pointers to local variables at compile time? For example, consider following code: template Repeat(alias int N, alias variable) { // Magic alias Repeat = /* Even more

Re: Rebind template(bug?)

2016-08-23 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 22 August 2016 at 21:46:35 UTC, Engine Machine wrote: I'm sorry if it confuses you... it doesn't confuse me. Confuses? No. I do not know why you have to try and prove something that is a preference. Do you often get in to arguments with people about how ford is better than chevy or

Re: Rebind template(bug?)

2016-08-22 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 22 August 2016 at 19:56:08 UTC, ag0aep6g wrote: So this is just to avoid typing out `class Pug : Dog {...} class Dog : Animal {...} class Animal {...}`? This allows you to create different inheritance chains with the same components quickly and easily. I don't know any use case, but

Re: Rebind template(bug?)

2016-08-22 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 22 August 2016 at 18:48:12 UTC, ag0aep6g wrote: You can take this further with template constraints. Gives it a more uniform appearance at the price of some repetition: class T() { int x; } class T(A...) : T!(A[0..$-1]) if (A.length > 0 && A[$-1] == "Animal") { int

Re: Rebind template(bug?)

2016-08-22 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 22 August 2016 at 18:04:43 UTC, Engine Machine wrote: How do you seriously think this is cleaner/simpler? 1. No extra encrypted things, such as InstantiateOrEmptySeq 2. Much more understandable. You have two classes. No. I have one template with two specializations. Class template

Re: Rebind template(bug?)

2016-08-22 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 22 August 2016 at 00:43:00 UTC, Engine Machine wrote: The following code works and does what I want! template InstantiateOrEmptySeq(alias tmpl, args...) { alias Seq(T...)=T; static if (args.length > 0) alias InstantiateOrEmptySeq = tmpl!(args[0 .. $-1]); else

Re: Rebind template(bug?)

2016-08-21 Thread Jack Applegame via Digitalmars-d-learn
On Sunday, 21 August 2016 at 19:29:26 UTC, Engine Machine wrote: I know you like to play the right or wrong game, but did you ever learn that a single example does not prove the truth of something? How about something more complex? Your demagogy will not help you learn the basics of the D

Re: Rebind template

2016-08-21 Thread Jack Applegame via Digitalmars-d-learn
On Sunday, 21 August 2016 at 00:06:07 UTC, Engine Machine wrote: On Saturday, 20 August 2016 at 22:21:00 UTC, ag0aep6g wrote: On 08/21/2016 12:11 AM, Engine Machine wrote: Is there a way to rebind the arguments of a template? template foo(X) { // X is like A!(a,b,c) Y =

Re: CT Inheritence structures

2016-08-20 Thread Jack Applegame via Digitalmars-d-learn
On Saturday, 20 August 2016 at 00:46:15 UTC, Engine Machine wrote: Any ideas? Something like this? mixin template TypeData(string type: "Animal") { int y; } mixin template TypeData(string type: "Dog") { int z; } mixin template TypeData(string type: "Pug") { int s; } template

Re: How about a special null template parameter?

2016-08-19 Thread Jack Applegame via Digitalmars-d
On Friday, 19 August 2016 at 18:25:06 UTC, Engine Machine wrote: It replaces the current method of having to define a non-templated class and a templated class. e.g., class Type { int x; } class Type(T) : Type { static if (T is Dog) int y; } What are you talking about? This code

  1   2   >