On Friday, 9 February 2024 at 02:55:48 UTC, Gary Chike wrote:
On Friday, 9 February 2024 at 02:13:04 UTC, Gary Chike wrote:
I spoke too soon, it appears Zig's default return type for its
`len()` function is: `usize' - similar to Rust.
```rust
const std = @import("std");
pub fn main() !void
On Friday, 9 February 2024 at 02:13:04 UTC, Gary Chike wrote:
Reviewing the default return type in a couple more newer
languages for the length function or equivalent. (`len()`,
`length()`, `size()`):
The Nim language appears to return an `int` type:
```python
let something = @['a', 'b',
On Thursday, 8 February 2024 at 16:54:36 UTC, Kevin Bailey wrote:
Additionally, it doesn't address the issue. It still requires
me to both realize the issue with comparing an int to length's
mystery type, as well as to fix it for the compiler.
(And it's beside the fact that the start value
On Thu, Feb 08, 2024 at 06:22:29PM +, Carl Sturtivant via
Digitalmars-d-learn wrote:
> On Wednesday, 7 February 2024 at 17:11:30 UTC, H. S. Teoh wrote:
> > Do we know why the compiler isn't getting it right? Shouldn't we be
> > fixing it instead of just turning off elision completely?
>
>
On Wednesday, 7 February 2024 at 17:11:30 UTC, H. S. Teoh wrote:
Do we know why the compiler isn't getting it right? Shouldn't
we be fixing it instead of just turning off elision completely?
This matter seems to have been an issue for some time.
On Thursday, 8 February 2024 at 16:54:36 UTC, Kevin Bailey wrote:
[...]
On Thursday, 8 February 2024 at 15:26:16 UTC, kdevel wrote:
Elegant and correct is this version:
```d
import std.stdio;
int main()
{
char[] something = ['a', 'b', 'c'];
writeln("len: ",
Arafel,
You're certainly correct. Priorities change. It used to be
thought that backwards compatibility was the way to attract
developers. But today the keyword is "safety".
Apparently 2022 was the year of the C++ successor. Some features
of D were mentioned in the discussion but D as a
On Thursday, 8 February 2024 at 15:00:54 UTC, Kevin Bailey wrote:
By all means, please share with us how you would have written
that just as elegantly but "correct".
Elegant and correct is this version:
```d
import std.stdio;
int main()
{
char[] something = ['a', 'b', 'c'];
On 8/2/24 16:00, Kevin Bailey wrote:
I'm asking, why is the default C compatibility (of all things) rather
than "safety that I can override if I need to make it faster" ?
I'm sure there are more experienced people here that will be able to
answer better, but as far as I remember, the policy
On Thursday, 8 February 2024 at 08:23:12 UTC, thinkunix wrote:
I would never write code like this.
By all means, please share with us how you would have written
that just as elegantly but "correct".
It would also break if the array 'something' had more than
int.max elements.
Then don't
On Wednesday, 7 February 2024 at 22:16:54 UTC, Alexander Zhirov
wrote:
Is there a way to identify a client by MAC address when using
the Vibe library?
The `NetworkAddress`
[structure](https://vibed.org/api/vibe.core.net/NetworkAddress)
does not provide such features. Or did I miss something?
Kevin Bailey via Digitalmars-d-learn wrote:
How many times does the following loop print? I ran into this twice
doing the AoC exercises. It would be nice if it Just Worked.
```
import std.stdio;
int main()
{
char[] something = ['a', 'b', 'c'];
for (auto i = -1; i < something.length;
12 matches
Mail list logo