Re: Crow programming language

2024-02-17 Thread IchorDev via Digitalmars-d-announce
On Thursday, 15 February 2024 at 23:46:10 UTC, andy wrote: Is it as simple as that? I'd have to cast away the `immutable` when adding a new interned string though. Is that still the correct way to do it? Oh no, you should never cast away immutable, that might lead to undefined behaviour (as

Re: Crow programming language

2024-02-16 Thread Steven Schveighoffer via Digitalmars-d-announce
On Thursday, 15 February 2024 at 23:46:10 UTC, andy wrote: On Thursday, 15 February 2024 at 15:24:37 UTC, IchorDev wrote: You can make a scope with `nothrow`, `@nogc`, etc.: I've been setting `@safe @nogc pure nothrow:` at the top of (almost) every module, but then I still have to do it at

Re: Crow programming language

2024-02-15 Thread andy via Digitalmars-d-announce
On Friday, 16 February 2024 at 03:21:48 UTC, andy wrote: It still seems to be considered mutable? I got this working using a function pointer: ``` @safe: void main() { string a = "a"; string ab = "ab"; string ab2 = a ~ "b"; assert(ab.ptr != ab2.ptr);

Re: Crow programming language

2024-02-15 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-announce
On 16/02/2024 4:21 PM, andy wrote: On Friday, 16 February 2024 at 01:26:42 UTC, Richard (Rikki) Andrew Cattermole wrote: You can use const instead which doesn't have any such guarantees and it'll work with a pure function :) It still seems to be considered mutable?     pure void main()

Re: Crow programming language

2024-02-15 Thread andy via Digitalmars-d-announce
On Friday, 16 February 2024 at 01:26:42 UTC, Richard (Rikki) Andrew Cattermole wrote: You can use const instead which doesn't have any such guarantees and it'll work with a pure function :) It still seems to be considered mutable? pure void main() { // a.d(2): Error: `pure`

Re: Crow programming language

2024-02-15 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-announce
On 16/02/2024 12:46 PM, andy wrote: If you make global variables |immutable|, you can access them in |pure| functions. Is it as simple as that? I'd have to cast away the |immutable| when adding a new interned string though. Is that still the correct way to do it? No. It was never

Re: Crow programming language

2024-02-15 Thread andy via Digitalmars-d-announce
On Thursday, 15 February 2024 at 15:24:37 UTC, IchorDev wrote: You can make a scope with `nothrow`, `@nogc`, etc.: I've been setting `@safe @nogc pure nothrow:` at the top of (almost) every module, but then I still have to do it at the top of each struct in the module (if it has functions)

Re: Crow programming language

2024-02-15 Thread IchorDev via Digitalmars-d-announce
On Thursday, 15 February 2024 at 04:32:27 UTC, andy wrote: * Having to write `@safe @nogc pure nothrow` all the time. It needs a way to make that the default and mark specific things as not-safe or not-pure. You can make a scope with `nothrow`, `@nogc`, etc.: ```d nothrow @nogc pure @safe{

Crow programming language

2024-02-14 Thread andy via Digitalmars-d-announce
For the past few years I've been writing a programming language entirely in D. The website https://crow-lang.org/ explains the language itself, so here I thought I'd include some comments on my experience writing a medium-sized project in D. ## Pros * Debug builds with DMD in under 5