D in AI Field

2021-03-15 Thread Lasheen via Digitalmars-d-learn

Hello, I'm a C programmer, and now i want to migrate to D.
i work in AI field, so i have some questions about D language:

1- is D suitable for mission critical systems(such as avionics 
systems) ?

 if (true){
2- what about safety, Security and reliability of D in Embedded 
systems ?

3- what about memory issues in D if i use it in AI ?
4- is there a compiler for AI ?
};
Thank you.


Can't call splitter with range struct

2021-03-15 Thread David Skluzacek via Digitalmars-d-learn
I came across this problem as I was trying to see if could write 
a quick range-based solution with std.zlib to do what was asked 
about in a different Learn forum post - read a gzipped file.


This seems like it should work:

import std.stdio, std.algorithm, std.zlib;
import std.range.primitives;

void main(string[] args)
{
auto f = GZippedFile(File(args[1], "rb"));
f.splitter("\n").each!writeln;
}

struct GZippedFile
{
File file;
UnCompress uncompressor;
ubyte[] readBuffer;
const(char)[] buffer;

this(File f) {
file = f;
uncompressor = new UnCompress(HeaderFormat.gzip);
readBuffer = new ubyte[4096];
}

dchar front() const {
return buffer.front;
}

void popFront() {
if (buffer.empty) {
buffer = cast(const(char)[])
uncompressor.uncompress(file.rawRead(readBuffer));
}
else {
buffer.popFront();
}
}

bool empty() {
return buffer.empty && file.eof();
}
}

But I get:

Error: template std.algorithm.iteration.splitter cannot deduce 
function from argument types !()(GZippedFile, string), candidates 
are:
/usr/include/dlang/dmd/std/algorithm/iteration.d(4678):
splitter(alias pred = "a == b", Range, Separator)(Range r, 
Separator s)

  with pred = "a == b",
   Range = GZippedFile,
   Separator = string
  must satisfy the following constraint:
   is(typeof(binaryFun!pred(r.front, s)) : bool)
(...)

If I change the newline separator to a character literal, I get:

(...)
/usr/include/dlang/dmd/std/algorithm/iteration.d(5055):
splitter(alias pred = "a == b", Range, Separator)(Range r, 
Separator s)

  with pred = "a == b",
   Range = GZippedFile,
   Separator = char
  must satisfy the following constraint:
   is(typeof(binaryFun!pred(r.front, s.front)) : bool)

It seems like "\n" should pass the second constraint and '\n' 
should pass the first.  Using a dchar or dstring makes no 
difference. Adding @property to front makes no difference. Is 
this a bug?




Re: WinUI 3

2021-03-15 Thread Imperatorn via Digitalmars-d-learn

On Monday, 15 March 2021 at 22:07:35 UTC, Siemargl wrote:

On Monday, 15 March 2021 at 16:41:08 UTC, Imperatorn wrote:

Could D be used with WinUI 3?

https://docs.microsoft.com/en-us/windows/apps/winui/winui3/

Would the win32metadata help? 樂


No need to going in another dead end


?


Re: WinUI 3

2021-03-15 Thread Siemargl via Digitalmars-d-learn

On Monday, 15 March 2021 at 16:41:08 UTC, Imperatorn wrote:

Could D be used with WinUI 3?

https://docs.microsoft.com/en-us/windows/apps/winui/winui3/

Would the win32metadata help? 樂


No need to going in another dead end


Re: WinUI 3

2021-03-15 Thread Paulo Pinto via Digitalmars-d-learn

On Monday, 15 March 2021 at 17:04:56 UTC, evilrat wrote:

On Monday, 15 March 2021 at 16:41:08 UTC, Imperatorn wrote:

Could D be used with WinUI 3?

https://docs.microsoft.com/en-us/windows/apps/winui/winui3/

Would the win32metadata help? 樂


I've seen some slides about WinUI 3 future directions and 
roadmap but haven't tried it yet.
Probably it will be PITA to use it right now in anything not 
.NET because of some core dependencies (IIRC some core stuff is 
in .NET), but plans have mentions it will be possible to use 
with ANY language closer to release date somewhere in Q3 2021.


But if it can be done using C++/WinRT right now then it is 
highly likely this will be possible to do it in D as well.


As for WinRT stuff there was some tools and bindings done by 
webfreak.

https://github.com/WebFreak001/dwinrt2
and/or
https://github.com/WebFreak001/dwinrt


WinUI core is WinRT, basically modern COM, no :NET dependencies.




Re: WinUI 3

2021-03-15 Thread evilrat via Digitalmars-d-learn

On Monday, 15 March 2021 at 16:41:08 UTC, Imperatorn wrote:

Could D be used with WinUI 3?

https://docs.microsoft.com/en-us/windows/apps/winui/winui3/

Would the win32metadata help? 樂


I've seen some slides about WinUI 3 future directions and roadmap 
but haven't tried it yet.
Probably it will be PITA to use it right now in anything not .NET 
because of some core dependencies (IIRC some core stuff is in 
.NET), but plans have mentions it will be possible to use with 
ANY language closer to release date somewhere in Q3 2021.


But if it can be done using C++/WinRT right now then it is highly 
likely this will be possible to do it in D as well.


As for WinRT stuff there was some tools and bindings done by 
webfreak.

https://github.com/WebFreak001/dwinrt2
and/or
https://github.com/WebFreak001/dwinrt


WinUI 3

2021-03-15 Thread Imperatorn via Digitalmars-d-learn

Could D be used with WinUI 3?

https://docs.microsoft.com/en-us/windows/apps/winui/winui3/

Would the win32metadata help? 樂