Re: Classes in D with betterC

2021-11-19 Thread Stanislav Blinov via Digitalmars-d-announce
On Saturday, 20 November 2021 at 05:37:42 UTC, rikki cattermole 
wrote:
And then there are issues such as 
https://issues.dlang.org/show_bug.cgi?id=21416 which killed off 
any chance of me using them internally.


...and the implementation, as presented, falls apart due to not 
forwarding arguments correctly. Not insurmountable, of course, 
although `forward` really should be an intrinsic and not a 
library function.


And due to looking for a `__dtor` instead of `__xdtor`. And due 
to the fact that ya can't use the proposed `destroy` function 
with a reference to base class and still call the destructor of 
derived class correctly, let alone infer attributes correctly. 
And due to it trusting the `pureFree` when it shouldn't.


Can't see anything news-worthy here. This has been possible for 
ages, and is still limited to wazoo by classes being married to 
druntime, pessimized by lack of proper forwarding in the 
language, and can't be @safe.


Classes in D with betterC

2021-11-19 Thread Walter Bright via Digitalmars-d-announce

https://lsferreira.net/posts/zet-1-classes-betterc-d/

by Luís Ferreira

It's currently on the front page of Hacker News:

https://news.ycombinator.com/


Re: dmt: Python-like indentation in D programming language

2021-11-19 Thread Witold Baryluk via Digitalmars-d-announce

On Friday, 19 November 2021 at 10:03:00 UTC, bauss wrote:


Isn't def redundant in this since D already declares types then 
you can assume if it's not enum, template, mixin template, 
class, struct or union then it must be a function if it also 
end with (...):


Like:

```d
int foo():
return 10
```

You'd never be in doubt that foo was a function or that:

```d
template Foo(T):
alias Foo = T
```

Foo in this case was a template.


Technically yes, but I do not have full proper parser or grammar,
to do the conversion in all possible cases.

The main issue is with the context:

`type name ` ... can be also a start of a variable with a lambda, 
even if it ends with `:`:


```d
auto x = delegate(int y):
   return y * y
```

The return type itself can be a complex template instantiation.

`F!() foo():`

Same with argument types, they might be templates (or maybe even 
mixins?).


Plus it does not necessarily ends with `(...):`, for example it 
can have attributes:


`... (...) pure nothrow @bar:`

Plus of course all the other things like `static`, `public`, 
`extern(...)`, ... at the front.


So yes, `dmt` is not perfect, but for now it still allows to use 
full feature set of D, and use simple rules for achieving these 
goals.


If the tool gains some popularity, there is certainly a possibly 
of adding a proper grammar and parser, and making `def` on 
functions optional. Proper parser will also help in few other 
places, like multi line signature definitions, comments in the 
middle of the multi line definition, enum definitions and array 
literals.




BTW.

I forgot to add to my initial post, that `dmt` generates the 
`#line` directives, making compile errors and warning from `dmd`, 
`gdc` and `ldc` point back exactly to the proper input `.dt` file 
and original line number in it.


And you can pass multiple file to `dmt` tool, including mix of 
`.dt` and non-`.dt` files (i.e. `.d`, `.o`) to link them all 
together by the compiler in expected fashion.




Great project tho!


Thanks.




DConf Online 2021 Links

2021-11-19 Thread Mike Parker via Digitalmars-d-announce
The DConf Online 2021 talks and livestreams are set and ready to 
go at their appointed times this weekend. All the links [are 
available on 
dconf.org](https://dconf.org/2021/online/index.html), but I'm 
also posting them here for convenience.


Don't forget:

* each speaker will each join the Q & A livestream 5 minutes 
prior to their talk

* Adam's livecoding session is in a separate livestream
* the Ask Us Anything! on Day Two happens in the Day Two Q & A 
Livestream


**Saturday, November 20**

* [Day One Q & A Livestream](https://youtu.be/uhxYUyTNZbg) - 
opens at 13:45 UTC
* [D for the 21st Century: Moving fast without breaking 
things](https://youtu.be/UqW42_8kn0s) - Átila Neves - 14:00 UTC
* [Fast and Coherent Reflection](https://youtu.be/05j8EHSyGSc) - 
Stefan Koch - 15:15 UTC
* [Life Outside the Big 4: The Adventure of D on 
OpenBSD](https://youtu.be/4Uu96MEoHqk) - Brian Callahan - 16:30 
UTC
* [Metaprogramming in D](https://youtu.be/0lo-FOeWecA) - Bradley 
Chatha - 17:45 UTC
* [Livecoding Session](https://youtu.be/XuYcZPYWbKk) - Adam D. 
Ruppe - 19:00 UTC


**Sunday, November 21**

* [Day Two Q & A Livestream](https://youtu.be/QbGGLoXwIf0) - 
opens at 13:45 UTC
* [Great Programming with ImportC](https://youtu.be/c3kJoFCzA-0) 
- Walter Bright - 14:00 UTC
* [A Deep Dive into GPU Text 
Rendering](https://youtu.be/16-gpcjeN6c) - Elijah Stone - 15:15 
UTC
* [GraphQL for D: Do the Boring 
Things](https://youtu.be/18_u5bfuNXY) - Robert Schadek - 16:30 UTC
* [The How and Why of Profiling D 
Code](https://youtu.be/6TDZa5LUBzY) - Max Haughton - 17:45 UTC
* [Ask Us Anything!](https://youtu.be/QbGGLoXwIf0) - Walter 
Bright, Átila Neves, Razvan Nitu - 19:00 UTC


See you there!




Re: dmt: Python-like indentation in D programming language

2021-11-19 Thread bauss via Digitalmars-d-announce
On Tuesday, 16 November 2021 at 21:58:24 UTC, Witold Baryluk 
wrote:

Hi,

`dmt` is an old project of mine from around year 2006. I ported 
it recently from D1 to D2, and added some extra features and 
support for extra keywords, and fixed few bugs here and there.


`dmt` is a converter (offline or auto-invoking compiler after 
conversion) from Python-like indention style to curly braces 
for D programming language.


https://github.com/baryluk/dmt

It is fun and easy to use, and maybe it would be of interested 
to you.


`example.dt`:

```d
def int f(int b):
int y = 0
foreach (i; 0..5):
  y += i * (i+b)
return y

struct A:
private:
int a
public:
int b_ = 5
def auto b() @property:
return b_

def void main():
import std
writefln!"%s %s"(f(5), A())
```

```shell
$ DMD=ldc2 dmt -run example.dt
ldc2 -run example.d
80 A(0, 5)
$
```

All D programming language features are supported (including 
exception handling, if/else, switch/case/break, inline asm, 
attribute sections, goto). Converted code is human readable.


You can check more examples in the README.md and in `tests/` 
directory.


`dmt` is not yet self hosting, but that is probably the next 
step. :)


Enjoy.


Isn't def redundant in this since D already declares types then 
you can assume if it's not enum, template, mixin template, class, 
struct or union then it must be a function if it also end with 
(...):


Like:

```d
int foo():
return 10
```

You'd never be in doubt that foo was a function or that:

```d
template Foo(T):
alias Foo = T
```

Foo in this case was a template.

Or like make def optional at least, because I see how it can help 
porting Python code, but it seems unnecessary if you're writing 
from scratch.


Great project tho!