On Monday, 11 April 2022 at 22:10:07 UTC, Ali Çehreli wrote:
1) I will not mutate data through this reference. For example,
a parameter that is pointer to const achieves that:
void foo (const(int)[] arr);
2) This variable is const:
const i = 42;
Well, there is the confusion: There is no
On Monday, 11 April 2022 at 21:48:56 UTC, Ali Çehreli wrote:
On 4/11/22 08:02, Paul Backus wrote:
> any pointers or references
To add, Salih and I were in an earlier discussion where that
concept appeared as "indirections."
Ali
I tried the following and I didn't understand one thing: Why
On Tue, Apr 12, 2022 at 10:07:15AM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 4/11/22 01:57, KytoDragon wrote:
>
> > Is there any way to import version specifiers from a separate file?
>
> Have you tried mixing in the versions? Have one file with the versions
> in it:
>
> //
On 4/11/22 01:57, KytoDragon wrote:
> Is there any way to import
> version specifiers from a separate file?
Have you tried mixing in the versions? Have one file with the versions
in it:
// file: 'versions'
version = x;
Then mix it in:
mixin (import ("versions"));
version (x) { /*
On 4/12/22 03:28, Dom DiSc wrote:
> On Monday, 11 April 2022 at 22:10:07 UTC, Ali Çehreli wrote:
>> 1) I will not mutate data through this reference. For example, a
>> parameter that is pointer to const achieves that:
>>
>> void foo (const(int)[] arr);
>>
>> 2) This variable is const:
>>
>>
On Monday, 11 April 2022 at 22:10:07 UTC, Ali Çehreli wrote:
On 4/11/22 05:57, wjoe wrote:
> And because the data could be
> in ROM any modification is an error.
Fully agreed. However, how could I initialize such an object
then? (You may have meant a read-only memory page instead of
ROM.)
On 4/12/22 12:54, wjoe wrote:
> I.e. immutable is constant data which is created at compile time - like
> laws of physics,
For completeness, we already have 'enum' and 'static const' for that.
> should get a better name - maybe 'in' and get rid of const.
Yes! 'in' for parameters! :D
>>
On Tuesday, 12 April 2022 at 19:54:13 UTC, wjoe wrote:
Especially since it's only a promise and the compiler accepts
this:
void foo (const(char)[] arr)
{
cast(char[])arr[0..3] = "baz";
}
string bar = "123";
foo(bar);
assert(bar=="baz");
But I could cast away const and modify the string bar.
On Wednesday, 6 April 2022 at 16:36:51 UTC, Tejas wrote:
Looks like a compiler bug, since substituting the real methods
makes the `mixin template` code compile fine
Hi Tejas,
Thank you very much for your answer!
Also, remove the `const`, otherwise the method will word only
on `const`
On Wednesday, 6 April 2022 at 17:33:28 UTC, Steven Schveighoffer
wrote:
As I mentioned elsewhere, it does work. But the situation I
think must be that it's only one mixin template. Probably also
you can't have any overloads in the type itself.
Note that I also think string mixins would work
On Wednesday, 6 April 2022 at 17:59:12 UTC, Adam D Ruppe wrote:
ooh yeah there's multiple here so the names don't
overload and one on the time itself would override the ones
from mixin template.
You'd have to alias them together on the type.
Hello Adam D Ruppe,
I see what you
11 matches
Mail list logo