sumtype 0.3.0

2018-05-06 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (*) - Self-referential types, using `This` - Works with `pure`, `@safe`, `@nogc`, and `immutable` (*) - Zero

Re: sumtype 0.3.0

2018-05-07 Thread Paul Backus via Digitalmars-d-announce
On Monday, 7 May 2018 at 09:23:04 UTC, Brian Schott wrote: I spent several hours trying to get this working with a non-trivial AST, and I think that it just isn't going to work until the compiler front-end gets better about handling recursive definitions. It fails in more-or-less the same way

Re: sumtype 0.3.0

2018-05-08 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 8 May 2018 at 06:33:38 UTC, TheGag96 wrote: Wow.. without comments and unittests, the implementation is only 116 lines. Awesome job. Even now I still find it incredible what D can do. Is Algebraic in the standard library really that bad? And if so, why aren't implementations like

Re: sumtype 0.3.0

2018-05-07 Thread Paul Backus via Digitalmars-d-announce
On Monday, 7 May 2018 at 19:28:16 UTC, Sönke Ludwig wrote: Another similar project: http://taggedalgebraic.dub.pm/ There's also tagged_union and minivariant on dub, that I've found. I'm definitely far from the first person to be dissatisfied with `Algebraic`, or to try my hand at writing a

Re: sumtype 0.3.0

2018-05-09 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 9 May 2018 at 13:33:44 UTC, jmh530 wrote: On Sunday, 6 May 2018 at 19:18:02 UTC, Paul Backus wrote: [snip] - Zero runtime overhead compared to hand-written C Just to clarify, would the run-time performance of the length function in the example be equivalent to if it had been

Re: Complicated Types: Prefer “alias this” Over “alias” For Easier-To-Read Error Messages

2018-05-21 Thread Paul Backus via Digitalmars-d-announce
On Monday, 21 May 2018 at 14:48:23 UTC, Mike Parker wrote: Nick Sabaluasky's first post to the D Blog is a tip on how to create an aliased type that keeps its name in error messages. I'm not sure making `_data` private is really a good idea. For example, this only works if `_data` is public:

sumtype 0.5.0

2018-08-08 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (*) - Self-referential types, using `This` - Works with `pure`, `@safe`, `@nogc`, and `immutable` (*) - Zero

Re: sumtype 0.5.0

2018-08-08 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 9 August 2018 at 00:11:22 UTC, Seb wrote: On Thursday, 9 August 2018 at 00:07:05 UTC, Seb wrote: (It uses the version from DUB and updates itself once daily, but somehow dub still lists 0.4.1 at the moment) It looks like you didn't push the git tag to GitHub:

Re: sumtype 0.5.0

2018-08-08 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 21:57:07 UTC, vit wrote: Nice, but destructor SumType.~this() can call destroy on reference type like class: Whoops. Good catch. I've pushed a fix, tagged as version 0.5.1.

Re: sumtype 0.5.0

2018-08-10 Thread Paul Backus via Digitalmars-d-announce
On Friday, 10 August 2018 at 13:11:13 UTC, Everlast wrote: On Friday, 10 August 2018 at 12:35:18 UTC, Everlast wrote: It would be nice if some actual examples could be given. The help on dub is a bit confusing because the the code is not complete. In addition to the example on the dub

Re: sumtype 0.5.0

2018-08-09 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 9 August 2018 at 07:52:12 UTC, vit wrote: SumType without initialization doesn't fail if first type has @disabled this(). It did fail for me, but it also failed *with* initialization too, so there was definitely a bug there. method toString is not template. (why is there in the

Re: sumtype 0.5.0

2018-08-09 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Version 0.5.2, with fixes for the bugs reported in this thread, is now available. Thanks to vit for their detailed feedback!

Re: sumtype 0.5.0

2018-08-10 Thread Paul Backus via Digitalmars-d-announce
On Friday, 10 August 2018 at 21:28:40 UTC, Everlast wrote: Yes, but alias Z = SumType.Union(X,Y); is not the same as alias Z = SumType!(int, float, string, complex, vector). In the first case Z is actually a union of 2 types while in the second it is of 5. There is a subtle difference

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-16 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm Looks great! auto john = some(new Person()); Would it also work to leave off the `some` here and skip the first `dispatch` in the following lines? (i.e., make `john` a `Person` rather than an

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-24 Thread Paul Backus via Digitalmars-d-announce
On Friday, 24 August 2018 at 20:59:34 UTC, aliak wrote: THis is true. And might be interesting to try out actually. Can you access the types in a SumType via index? I'm thinking because Optional behaves like a range, and I guess I'd define a SumType!(T, None), then a rough outline may be:

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-22 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 22 August 2018 at 22:11:05 UTC, aliak wrote: On Monday, 20 August 2018 at 19:52:53 UTC, jmh530 wrote: It's interesting that both sumtype and optional have match templates. Maybe scope to combine these projects? That'd be cool. Optional uses .match on a "some" or "none" range,

Re: sumtype 0.5.0

2018-08-22 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. New point release, 0.5.3, with the following updates: - SumType now uses the smallest possible integer type for its tag (e.g.,

expectations 0.1.0

2018-09-02 Thread Paul Backus via Digitalmars-d-announce
expectations is an error-handling library that lets you bundle exceptions together with return values. It is based on Rust's Result [1] and C++'s proposed std::expected. [2] If you're not familiar with those, Andrei's NDC Oslo talk, "Expect the Expected" [3], explains the advantages of this

Re: expectations 0.1.0

2018-09-04 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 2 September 2018 at 06:59:20 UTC, Paul Backus wrote: expectations is an error-handling library that lets you bundle exceptions together with return values. It is based on Rust's Result [1] and C++'s proposed std::expected. [2] If you're not familiar with those, Andrei's NDC Oslo

Re: expectations 0.1.0

2018-09-05 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 4 September 2018 at 22:08:48 UTC, Nick Sabalausky (Abscissa) wrote: I think you may be getting hung up on a certain particular detail of Vladimir's exact "draft" implementation of Success, whereas I'm focusing more on Success's more general point of "Once the object is no longer

Re: Wed Oct 17 - Avoiding Code Smells by Walter Bright

2018-11-05 Thread Paul Backus via Digitalmars-d-announce
On Monday, 5 November 2018 at 05:55:02 UTC, unprotected-entity wrote: ok. Now, what are your options then (assuming you want an independent type)? (option 1) define one encapsulated type, per module. (option 2) have a means for type independence within a module - i.e. selective hiding. D

Re: lodash like utility/algorithms library for D

2018-09-30 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 30 September 2018 at 22:17:05 UTC, aliak wrote: On Saturday, 29 September 2018 at 19:27:29 UTC, Paul Backus wrote: I agree that this is useful, but why not just return a naked `SumType!(string, JSONError)` in that case? Is there some additional value added by the `Expect` wrapper

Re: lodash like utility/algorithms library for D

2018-09-29 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 29 September 2018 at 12:40:14 UTC, aliak wrote: I.e. by allowing you to define the unexepcted you could for instance: enum JSONError { invalidKey, notString, notNumber } auto a = parse(jsonData); a.getAsString("key").match!( (string value) => // yay (JSONError error)

Re: expectations 0.1.0

2018-09-03 Thread Paul Backus via Digitalmars-d-announce
On Monday, 3 September 2018 at 04:49:40 UTC, Nick Sabalausky (Abscissa) wrote: Note that the above has *nothing* to do with retrieving a value. Retrieving a value is merely used by the implementation as a trigger to lazily decide whether the caller wants `foo` or `tryFoo`. Going out of scope

Re: expectations 0.1.0

2018-09-02 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 2 September 2018 at 23:38:41 UTC, Per Nordlöw wrote: On Sunday, 2 September 2018 at 06:59:20 UTC, Paul Backus wrote: expectations is an error-handling library that lets you bundle exceptions together with return values. It is based on Rust's Result [1] and C++'s proposed

Re: expectations 0.1.0

2018-09-02 Thread Paul Backus via Digitalmars-d-announce
On Monday, 3 September 2018 at 00:52:39 UTC, Vladimir Panteleev wrote: Please correct me if I'm wrong, but from looking at the code, given e.g.: Expected!void copyFile(string from, string to); nothing prevents me from writing: void main() { copyFile("nonexistent", "target"); } The success

Re: expectations 0.1.0

2018-09-03 Thread Paul Backus via Digitalmars-d-announce
On Monday, 3 September 2018 at 21:55:57 UTC, Nick Sabalausky (Abscissa) wrote: By contrast, a function that returns an `Expected!T` does *not* force its caller to acknowledge it. If an error occurs, and the caller never checks value or hasValue...nothing happens. That's called squelching an

Re: lodash like utility/algorithms library for D

2018-09-28 Thread Paul Backus via Digitalmars-d-announce
On Friday, 28 September 2018 at 14:02:48 UTC, aliak wrote: Hi, [...] Lots of good stuff here! I'm curious about your approach to `Expect`, since I've written a version of it myself. How useful have you found being able to use unexpected values of any type, as opposed to just exceptions?

Re: B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)

2019-01-17 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 17 January 2019 at 16:06:39 UTC, bpr wrote: On Thursday, 17 January 2019 at 01:59:29 UTC, Walter Bright wrote: Bartosz Milewski is a C++ programmer and a Haskell fan. He once gave a presentation at NWCPP where he wrote a few lines of Haskell code. Then, he showed the same code

Re: B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)

2019-01-18 Thread Paul Backus via Digitalmars-d-announce
On Friday, 18 January 2019 at 20:03:48 UTC, Mark wrote: [...] Represent types as strings, CTFE them as you see fit, and output a string that can then be mixin'ed to use the actual type. :) Two problems: 1) Mixing in a string is unhygienic. If two modules (or two scopes in the same module)

Re: My Meeting C++ Keynote video is now available

2019-01-14 Thread Paul Backus via Digitalmars-d-announce
On Monday, 14 January 2019 at 21:08:50 UTC, Ben Jones wrote: Is it possible to declare a function whose name is a CTFE computed string? Yes, if you do it with a string mixin.

Re: My Meeting C++ Keynote video is now available

2019-01-14 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 15 January 2019 at 05:18:45 UTC, aliak wrote: Quote from article: "The languages with the strongest positive coefficients - meaning associated with a greater number of defect fixes are C++, C, and Objective-C, also PHP and Python. On the other hand, Clojure, Haskell, Ruby and

Re: D-lighted, I'm Sure

2019-01-19 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 19 January 2019 at 22:07:47 UTC, Ron Tarrant wrote: On Friday, 18 January 2019 at 18:59:59 UTC, JN wrote: Just add a line in your dub.json file and you have the library. Need to upgrade to newer version? Just change the version in dub.json file. Need to download the problem from

Re: A brief survey of build tools, focused on D

2018-12-15 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 12 December 2018 at 22:41:50 UTC, H. S. Teoh wrote: It's time we came back to the essentials. Current monolithic build systems ought to be split into two parts: (1) Dependency detector / DAG generator. Do whatever you need to do here: dub-style scanning of .d imports, scan

sumtype 0.7.0

2018-11-20 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (★) - Self-referential types, using `This` - Works with pure, @safe, @nogc, and immutable (★) - Zero runtime

Re: sumtype 0.7.0

2018-11-21 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 22 November 2018 at 00:02:18 UTC, H. S. Teoh wrote: Any way this could be expanded to arbitrary types like Variant? Or is that not possible without reverting to TypeInfo dependency? T Not possible, unfortunately--for that and other reasons.

Re: My Meeting C++ Keynote video is now available

2019-01-13 Thread Paul Backus via Digitalmars-d-announce
On Monday, 14 January 2019 at 03:58:37 UTC, Mike Franklin wrote: What I wonder is, with design by introspection and the right mix of other language features (e.g. `alias`, `alias this`, mixins, etc...), what traditional language features can be removed from the compiler and delegated to

Re: Bitblob (hash wrapper) & Minivariant (tagged union) dub packages

2019-01-22 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 22 January 2019 at 10:26:33 UTC, Mathias Lang wrote: ## Minivariant https://github.com/Geod24/minivariant Minivariant is a "works for me" replacement of `std.variant : Algebraic`. [...] I looked into fixing it, but given Variant's design (which relies heavily on `TypeInfo`) it

sumtype 0.8.3

2019-02-25 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (★) - Self-referential types, using `This` - Works with pure, @safe, @nogc, and immutable (★) - Zero runtime

Re: DIP 1018--The Copy Constructor--Formal Review

2019-02-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 February 2019 at 20:41:58 UTC, Paolo Invernizzi wrote: Honestly, I've not understood the rationale or the covered use case in letting the copy ctor mutate the ref source parameters... Sincerely, without polemical intent. - P Because D's const is transitive, you can't

Re: sumtype 0.8.3

2019-02-26 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 26 February 2019 at 12:52:11 UTC, JN wrote: On Monday, 25 February 2019 at 20:31:43 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Is it a better alternative? Seems like it from the description. If

Re: sumtype 0.8.3

2019-03-03 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 3 March 2019 at 14:32:55 UTC, Jacob Shtokolov wrote: On Monday, 25 February 2019 at 20:31:43 UTC, Paul Backus wrote: - Pattern matching, including support for structural matching (★) What is the main difference between 'match()' in this library and 'visit()' in std.variant?

Re: taggedalgebraic 0.11.0 adds TaggedUnion

2019-02-23 Thread Paul Backus via Digitalmars-d-announce
On Friday, 22 February 2019 at 17:09:41 UTC, Sönke Ludwig wrote: - Behaves like a POD if only POD fields exist, is non-copyable if any contained type is non-copyable etc. In fact, if a contained type is non-copyable, it fails to compile altogether. (Example code below.) Granted, so do

Re: DIP 1016--ref T accepts r-values--Formal Assessment

2019-02-01 Thread Paul Backus via Digitalmars-d-announce
On Friday, 1 February 2019 at 23:24:44 UTC, Olivier FAURE wrote: At no point is the compiler aware that the user intends for x to be interpreted as a getter. In theory, at least, that's what @property is for.

Re: DIP 1016--ref T accepts r-values--Formal Assessment

2019-02-04 Thread Paul Backus via Digitalmars-d-announce
On Monday, 4 February 2019 at 18:35:37 UTC, bitwise wrote: On Monday, 4 February 2019 at 18:32:56 UTC, Dominikus Dittes Scherkl wrote: I don't understand this. What does "(return)?" mean? Is this valid D syntax? What do I miss? I meant for that to be interpreted like a Regular expression,

sumtype 0.9.0: BetterC and DIP 1000 support

2019-09-28 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is designed to be an improved alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for introspection-based matching (★) - Self-referential types, using `This` - Works with `pure`, `@safe`, `@nogc`,

Re: Blog Post: Beating std::visit Without Really Trying

2019-10-06 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 6 October 2019 at 21:49:59 UTC, Joseph Rushton Wakeling wrote: I'm not fluent in assembly so, leaving the error path aside, I wasn't sure how to interpret the "main path" assembly from the D and Rust code, and whether they were practically equivalent (clearly the assembly posted

Re: Blog Post: Beating std::visit Without Really Trying

2019-10-06 Thread Paul Backus via Digitalmars-d-announce
On Monday, 7 October 2019 at 01:09:34 UTC, Andrei Alexandrescu wrote: Well also in the case of SumType there's not even much battle-testing. It's more of an implementation than a design. Take the existing variant, keep the interface, remove the cruft, put in the new nice code. Make it pass the

Re: Blog Post: Beating std::visit Without Really Trying

2019-10-07 Thread Paul Backus via Digitalmars-d-announce
On Monday, 7 October 2019 at 08:07:01 UTC, Joseph Rushton Wakeling wrote: Where's the breaking change? Are there selections of handlers that work for visit and don't work with match? Yes. https://run.dlang.io/is/UpaY2E

Blog Post: Beating std::visit Without Really Trying

2019-10-04 Thread Paul Backus via Digitalmars-d-announce
I was curious how C++17's std::variant compared to the options we have in D, like Algebraic and SumType, so I did a simple comparison of the generated assembly for each of them. You can read about it at the link below. And as you can probably guess from the title, D comes out ahead, in the

Re: Blog Post: Beating std::visit Without Really Trying

2019-10-05 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 5 October 2019 at 13:58:52 UTC, Seb wrote: On Saturday, 5 October 2019 at 06:40:35 UTC, Arun Chandrasekaran wrote: Good one. Any plans to push SumType as a replacement of Phobo's Algebraic? Phobos is essentially dead/frozen (feature-wise). Though if someone ever manages to get

Re: Blog Post: Beating std::visit Without Really Trying

2019-10-05 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 5 October 2019 at 04:07:45 UTC, Meta wrote: I'm not sure if you're aware, but funnily enough, I also wrote an article[1] on std::variant vs. the D alternative that references Matt Kline's article on std::visit. It seems we're really making getting our money's worth from his

Re: wc in D: 712 Characters Without a Single Branch

2020-01-28 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 28 January 2020 at 14:01:35 UTC, Mike Parker wrote: Robert Schadek was inspired by a post he saw on Hacker News a while back showing an implementation of wc in Haskell totaling 80 lines. He decided he could do better in D. So he did. This post on the D blog shows what he came up

Re: DIP1028 - Rationale for accepting as is

2020-05-21 Thread Paul Backus via Digitalmars-d-announce
On Friday, 22 May 2020 at 01:22:19 UTC, Walter Bright wrote: I have made these points before, but I'll summarize them here for convenient referral. [...] First, thank you for taking the time to summarize your position. I understand your objection to the proposed amendment much better

Re: DIP1028 - Rationale for accepting as is

2020-05-22 Thread Paul Backus via Digitalmars-d-announce
On Friday, 22 May 2020 at 05:37:55 UTC, Walter Bright wrote: On 5/21/2020 8:36 PM, Paul Backus wrote: Something ought to be done to prevent this. It doesn't have to be the exact proposal from the discussion thread, but doing nothing and allowing widespread silent breakage cannot possibly be

Re: DIP1028 - Rationale for accepting as is

2020-05-22 Thread Paul Backus via Digitalmars-d-announce
On Friday, 22 May 2020 at 13:58:14 UTC, bachmeier wrote: On Friday, 22 May 2020 at 03:36:03 UTC, Paul Backus wrote: This is the nightmare scenario that people are worried about: safety violations being introduced *silently* into existing, correct D code. Honest question: What is the use case

Re: DIP1028 - Rationale for accepting as is

2020-05-22 Thread Paul Backus via Digitalmars-d-announce
On Friday, 22 May 2020 at 14:43:27 UTC, bachmeier wrote: If you're compiling a program that calls into C, you know that's what you're doing, so you know you've given up any guarantees of safety. The entire problem is that with DIP 1028, I *don't* know what I'm doing, because the compiler

Re: DIP1028 - Rationale for accepting as is

2020-05-23 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 23 May 2020 at 15:33:05 UTC, H. S. Teoh wrote: On Sat, May 23, 2020 at 10:55:40AM + And this is precisely why I proposed that what we need is a way for the compiler to mechanically check all code *except* certain specified blackboxes that are skipped over. Then you can have

Re: DIP 1028--Make @safe the Default--Formal Assessment

2020-05-21 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 21 May 2020 at 17:03:49 UTC, bachmeier wrote: The problem as I see it is someone making a decision on his own DIP. That just doesn't make any sense to me, and I've stated that numerous times. Walter has a tendency to throw gas on the fire by ignoring much of the feedback and not

Re: Beta 2.094.0

2020-09-12 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 12 September 2020 at 13:40:34 UTC, Per Nordlöw wrote: On Saturday, 12 September 2020 at 13:03:29 UTC, Paul Backus wrote: How many improvements does this warning have to block before we decide its value for the language is net-negative? There's also the option of improving the

Re: Beta 2.094.0

2020-09-12 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 12 September 2020 at 11:43:03 UTC, MoonlightSentinel wrote: Currently looking into enabling it by default but it showed an interesting side effect. The frontend can now conclude that a == b is always true if a and b are instances of an empty struct (without custom opEquals).

Re: D mentionned in the ARTIBA webzine for an article on Silq

2020-09-04 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 3 September 2020 at 09:24:01 UTC, Jacob Carlborg wrote: On Thursday, 3 September 2020 at 08:40:32 UTC, aberba wrote: The slack I have no ideas how people get in. I know there's a number of members in there too. Unfortunately you need to be invited. Anyone can do it, if you're

Re: LDC 1.24.0-beta1

2020-10-19 Thread Paul Backus via Digitalmars-d-announce
On Monday, 19 October 2020 at 13:59:42 UTC, Adam D. Ruppe wrote: On Monday, 19 October 2020 at 13:43:14 UTC, Bastiaan Veelo wrote: I'm not suggesting that this fills the need of newbies, but there is this: https://dlang.org/install.html. Nobody should ever follow those terrible instructions,

Re: Blog Post: What Does Memory Safety Really Mean in D?

2020-08-27 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 26 August 2020 at 15:34:26 UTC, Dennis wrote: On Wednesday, 26 August 2020 at 14:29:46 UTC, Dukc wrote: I think there is a workaround to the variable access being always safe. Something like this in a dedicated module: ``` struct SystemVar(T, bool safeVal) { private T _var;

Re: Blog Post: What Does Memory Safety Really Mean in D?

2020-08-27 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 27 August 2020 at 14:10:36 UTC, Dennis wrote: On Thursday, 27 August 2020 at 13:32:44 UTC, Paul Backus wrote: Of course, you could also argue that these are things that shouldn't be allowed in @safe code to begin with--regardless of whether pointers are involved. I did not

Re: Blog Post: What Does Memory Safety Really Mean in D?

2020-08-23 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 23 August 2020 at 19:39:35 UTC, Paul Backus wrote: https://pbackus.github.io/blog/how-does-memory-safety-work-in-d.html Oops, wrong link. Here's the correct one: https://pbackus.github.io/blog/what-does-memory-safety-really-mean-in-d.html

Blog Post: What Does Memory Safety Really Mean in D?

2020-08-23 Thread Paul Backus via Digitalmars-d-announce
https://pbackus.github.io/blog/how-does-memory-safety-work-in-d.html What exactly do we mean when we talk about "memory safety" in D? Is it the same thing as "undefined behavior"? Is it ever correct to mark and `extern(C)` function as `@trusted`? This post is my attempt to understand, and

sumtype 0.10.0: multiple dispatch

2020-09-23 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is designed to be an improved alternative to `std.variant.Algebraic`. Features: - Pattern matching, including: - Match-by-introspection ("if it compiles, it matches") (★) - Multiple dispatch (★) - Support for self-referential types

Re: Rationale for accepting DIP 1028 as is

2020-05-27 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 27 May 2020 at 05:54:32 UTC, Walter Bright wrote: On 5/26/2020 1:32 PM, Paul Backus wrote: The reason extern function declarations are particularly problematic is that changing them from @system-by-default to @safe-by-default can cause *silent* breakage in existing, correct

Re: Rationale for accepting DIP 1028 as is

2020-05-28 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 28 May 2020 at 02:47:01 UTC, Jonathan M Davis wrote: Walter has acknowledged the problem and seems to think that because it's the programmer's responsibility to deal with extern(C) functions correctly (since it's not possible for the compiler to do it), it's up to the programmer

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 13:22:36 UTC, Petar Kirov [ZombineDev] wrote: On Monday, 25 May 2020 at 13:14:51 UTC, Petar Kirov [ZombineDev] wrote: It may be true (of course modulo meta-programming) that it doesn't make a difference for the calling code, but I personally want have the guarantees

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 15:07:19 UTC, Petar Kirov [ZombineDev] wrote: I don't want to change the definition of @safe in D, but would rather like if D supported @strongSafe, that interested people like me could opt into. I know that worded like this it may sound like too narrow feature to add

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 12:30:11 UTC, Zoadian wrote: On Monday, 25 May 2020 at 10:41:43 UTC, rikki cattermole wrote: It is meant to mean that at some point it has been mechanically checked by the compiler. Either during current compilation or a prior one. Which means it has to be valid on

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 17:09:50 UTC, Clarice wrote: On Monday, 25 May 2020 at 16:47:50 UTC, Paul Backus wrote: the compiler must warn D programmers that their declarations need to be reviewed for compatibility with @safe-by-default. Whether they were reviewed before that or not makes no

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 19:35:04 UTC, Clarice wrote: I really appreciate your contributions. (The latter of which will be quite handy.) But isn't the whole point of Walter's implementation of @safe-as-default is that FFIs are going to be assumed @safe? So they should still compile; that is

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 18:39:16 UTC, mw wrote: Can we declare the new D compiler version 3.0 for @safe-as-default? and keep version 2.x compiler for the old @system-as-default? @safe-by-default is currently hidden behind a -preview switch. I think it's safe to assume there will be a

Re: DIP1028 - Rationale for accepting as is

2020-05-25 Thread Paul Backus via Digitalmars-d-announce
On Monday, 25 May 2020 at 16:29:24 UTC, Atila Neves wrote: On Sunday, 24 May 2020 at 16:44:01 UTC, Paul Backus wrote: If we were designing a new language from scratch, I would agree 100% with your reasoning. The problem is that there are un-annotated declarations in existing code that have

Re: DIP1028 - Rationale for accepting as is

2020-05-24 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 24 May 2020 at 03:28:25 UTC, Walter Bright wrote: I'd like to emphasize: 1. It is not possible for the compiler to check any declarations where the implementation is not available. Not in D, not in any language. Declaring a declaration safe does not make it safe. 2. If

Re: DIP 1028 "Make @safe the Default" is dead

2020-05-29 Thread Paul Backus via Digitalmars-d-announce
On Friday, 29 May 2020 at 04:53:07 UTC, Walter Bright wrote: The subject says it all. If you care about memory safety, I recommending adding `safe:` as the first line in all your project modules, and annotate individual functions otherwise as necessary. For modules with C declarations, do as

Re: DIP 1028 "Make @safe the Default" is dead

2020-05-30 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 30 May 2020 at 16:17:49 UTC, Steven Schveighoffer wrote: +1 this would be perfect. Not sure if this would work either, but both of these are already reserved words: default @safe: -Steve It would probably have to be something more like `default(@safe)`, since `default

Re: Alpine Linux 3.12 Released With D Language Support

2020-05-30 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 30 May 2020 at 21:48:32 UTC, Johan wrote: Great work. Which compilers (and versions) are available? -Johan Looks like dmd [1], ldc [2], and gdc [3] are all there. [1] https://pkgs.alpinelinux.org/package/edge/community/x86_64/dmd [2]

Re: Rationale for accepting DIP 1028 as is

2020-05-26 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 26 May 2020 at 22:47:03 UTC, Gregory wrote: If Walter believed greenwashing was actually a problem, then the best solution to prevent it would be to not make @safe by default. If it's not that serious of a problem that he will push through @safe by default, then greenwashing isn't

Re: Rationale for accepting DIP 1028 as is

2020-05-26 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 26 May 2020 at 17:50:58 UTC, Gregory wrote: Which will just lead people to pure @trusted: at the top of their code to get it to compile again, with or without extern(C) being @safe by default. Then someone that uses it as dependency will mistaken think it is @safe. What's to stop

Re: DIP 1028--Make @safe the Default--Formal Assessment

2020-05-22 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 21 May 2020 at 13:51:34 UTC, Mike Parker wrote: DIP 1028, "Make @safe the Default", has been accepted without comment. https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1028.md I've made a draft PR to try and address the potential safety issue discussed in this thread.

Re: DIP1028 - Rationale for accepting as is

2020-05-22 Thread Paul Backus via Digitalmars-d-announce
On Friday, 22 May 2020 at 19:16:26 UTC, ag0aep6g wrote: I for one liked it better when it had that aspiration. And I was contributing towards that goal (latest PR was merged just yesterday, coincidentally [1]). [1] https://github.com/dlang/dlang.org/pull/2773 Thank you for that PR, by the

Re: Post: Why no one is using your D library

2020-07-02 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 2 July 2020 at 14:56:09 UTC, aberba wrote: Why no one is using your D library So I decided to write a little something special. Its my love letter to D folks. https://aberba.vercel.app/2020/why-no-one-is-using-your-d-library/ Excellent article. As the author of a

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-17 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 16 June 2020 at 13:31:49 UTC, Atila Neves wrote: With a few changes, yes (added missing semicolons, changed IGeometry to Geometry in `measure`, passed the current module so tardy can find the UFCS functions, added `@safe pure` to the UFCS functions: [...] void main() {

Re: News on the D Blog: SAOC 2020 and More

2020-06-24 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 24 June 2020 at 16:15:30 UTC, Andrei Alexandrescu wrote: On 6/23/20 10:31 AM, Meta wrote: By the way I found this helpful: https://chrome.google.com/webstore/detail/smile-always/jgpmhnmjbhgkhpbgelalfpplebgfjmbf?hl=en And for firefox users:

Re: From the D Blog: A Pattern for Head-mutable Structures

2020-06-27 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 27 June 2020 at 15:06:12 UTC, Avrina wrote: Do you understand what prioritizing is? Fake internet points are being prioritized over ease of access to the community. Another way to frame it is that "respecting the rules of another community (HN) is being prioritized over a minor

Re: Interesting work on packing tuple layout

2020-06-14 Thread Paul Backus via Digitalmars-d-announce
On Sunday, 14 June 2020 at 16:26:17 UTC, Avrina wrote: The situation also applies to the only tuple implementation in D. If you are proposing a new type with emphasis on reducing the footprint of the tuple then I don't see a problem with that. Changing the existing tuple implementation would

addle 0.1.0 - argument-dependent lookup for UFCS functions

2020-06-20 Thread Paul Backus via Digitalmars-d-announce
Are you tired of D's sane, straightforward scoping rules? Itching for a taste of that old-fashioned C++ madness? Well, itch no more: addle is here to help. addle is a tiny library that implements C++-style argument-dependent lookup (ADL) for D, on an opt-in basis. It lets you extend existing

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-13 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy https://github.com/atilaneves/tardy Cool stuff! What's the reasoning behind implementing your own vtables instead of using D's built-in object system? Don't want to be stuck inheriting from

Re: DConf Online 2020 (Formal Announcement)

2020-07-23 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 23 July 2020 at 14:43:23 UTC, Mike Parker wrote: I've just published the formal announcement of DConf Online 2020 to the blog and shared it on reddit. If you have time, please check the comments in the reddit thread for any questions you can answer and myths you can refute about

Re: Article: the feature that makes D my favorite programming language

2020-07-25 Thread Paul Backus via Digitalmars-d-announce
On Saturday, 25 July 2020 at 18:24:22 UTC, Jesse Phillips wrote: On Saturday, 25 July 2020 at 14:47:01 UTC, aberba wrote: On Saturday, 25 July 2020 at 13:28:34 UTC, Adam D. Ruppe wrote: On Saturday, 25 July 2020 at 11:12:16 UTC, aberba wrote: Oop! Chaining the writeln too could have increased

Re: Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1

2021-01-11 Thread Paul Backus via Digitalmars-d-announce
On Monday, 11 January 2021 at 21:17:20 UTC, jmh530 wrote: Of course, the typical response would be, "well why not use alias s = static array". I would ask what about an @nogc unittest where the author is trying to limit calls to functions that aren't really central to what is being tested.

Re: Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1

2021-01-11 Thread Paul Backus via Digitalmars-d-announce
On Monday, 11 January 2021 at 22:28:04 UTC, jmh530 wrote: On Monday, 11 January 2021 at 21:33:36 UTC, Paul Backus wrote: On Monday, 11 January 2021 at 21:17:20 UTC, jmh530 wrote: Of course, the typical response would be, "well why not use alias s = static array". I would ask what about an

Re: sumtype 1.0.0

2020-11-24 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 24 November 2020 at 23:02:15 UTC, Dibyendu Majumdar wrote: Thanks - I was suggesting adding a description to the documentation, unless it is already there. Also an ABI specification would be helpful - what happens when a value is passed to a C program. Thanks for the

Re: sumtype 1.0.0

2020-11-24 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 24 November 2020 at 21:52:47 UTC, Dibyendu Majumdar wrote: On Sunday, 15 November 2020 at 20:05:16 UTC, Paul Backus wrote: SumType is a generic discriminated union type for modern D. It is designed to be an improved alternative to `std.variant.Algebraic`. Nice. Is it possible to

Re: sumtype 1.0.0

2020-11-24 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 25 November 2020 at 00:56:39 UTC, sarn wrote: On Wednesday, 25 November 2020 at 00:20:54 UTC, Paul Backus wrote: The exact memory layout and ABI of SumType is deliberately left unspecified. It's an implementation detail that client code isn't supposed to rely on. If you want to

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 03:56:13 UTC, 9il wrote: On Sunday, 20 December 2020 at 11:00:05 UTC, Tobias Pankrath wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Thanks for sharing it! Could you

  1   2   >