Search Engine

2014-10-06 Thread ANtlord via Digitalmars-d-learn
Good day! I recenlty have tried create typical project on vibe.d. The web framework is not bad. And I can say, that it is better that something another web frameworks. But I have met a problem. I can't find search engine. I use xapian always. It has API for several languages, but except D. I

Re: Search Engine

2014-10-08 Thread ANtlord via Digitalmars-d-learn
On Monday, 6 October 2014 at 18:54:53 UTC, yawniek wrote: On Monday, 6 October 2014 at 17:11:51 UTC, ANtlord wrote: Good day! I recenlty have tried create typical project on vibe.d. The web framework is not bad. And I can say, that it is better that something another web frameworks. But I have

Re: Search Engine

2014-10-09 Thread ANtlord via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 20:15:33 UTC, Chris Williams wrote: On Wednesday, 8 October 2014 at 18:15:08 UTC, ANtlord wrote: It would be stable? I mean program, that will use C++ extern interface. Trying to link to C++ code will cause some work to solve build issues, but there shouldn't

Calling methods under gdb.

2016-07-24 Thread ANtlord via Digitalmars-d-learn
Hello everyone! I want to contribute some project, but I have inconvenient things related to debug. My high level of using GDB is show a variable and get type of a variable. In C++ usually I use QtCreator and debugging was pretty. In Python I have PDB, that can evaluate code. In D I have

DMD JSON output

2017-02-25 Thread ANtlord via Digitalmars-d-learn
Hello! I've encroutered intresting tool of DMD. It is dump of AST in JSON format (dmd -X main.d). But I it contains only declaration of methods, templates and structs. It doesn't contain statements like a variables or nested functions inside function's body. Is it possible to make dump with

Re: About debugging (again)

2016-10-20 Thread ANtlord via Digitalmars-d-learn
On Monday, 17 October 2016 at 19:17:25 UTC, Basile B. wrote: On Monday, 17 October 2016 at 19:14:49 UTC, ANtlord wrote: redirect to ddemangle, that's its job. Do you know the way how to redirect? I've tried as you have written above and this makes impossible to type any command to gdb.

Re: About debugging (again)

2016-10-17 Thread ANtlord via Digitalmars-d-learn
On Monday, 17 October 2016 at 15:43:32 UTC, ANtlord wrote: Hello! I've met an issue related to debugging by GDB. Directly when I try to show call stack I get like this http://pastebin.com/kRFRqznq. How can I make name of methods more human readable? I see part of printed name matches to name

About debugging (again)

2016-10-17 Thread ANtlord via Digitalmars-d-learn
Hello! I've met an issue related to debugging by GDB. Directly when I try to show call stack I get like this http://pastebin.com/kRFRqznq. How can I make name of methods more human readable? I see part of printed name matches to name of methods from code and I can suppose what method was

Re: About debugging (again)

2016-10-17 Thread ANtlord via Digitalmars-d-learn
On Monday, 17 October 2016 at 17:53:30 UTC, Basile B. wrote: On Monday, 17 October 2016 at 17:46:05 UTC, Basile B. wrote: On Monday, 17 October 2016 at 15:45:56 UTC, ANtlord wrote: On Monday, 17 October 2016 at 15:43:32 UTC, ANtlord wrote: [...] Oh Sorry, I've forgotten about pointing

Re: About debugging (again)

2016-10-17 Thread ANtlord via Digitalmars-d-learn
On Monday, 17 October 2016 at 17:57:19 UTC, Martin Krejcirik wrote: On Monday, 17 October 2016 at 15:45:56 UTC, ANtlord wrote: GDB 7.7.1 Use latest GDB, 7.10 has got much better D support. Tested on GDB 7.11.1. Same case :(

Re: Delay allocating class instance in stack.

2017-03-22 Thread ANtlord via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 13:19:32 UTC, Nicholas Wilson wrote: On Wednesday, 22 March 2017 at 08:57:34 UTC, ANtlord wrote: You still have the buffer (the class has to go somewhere!), but it is implicit (you can't refer to it directly only through the class reference) and so is the

Re: Delay allocating class instance in stack.

2017-03-21 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 08:12:36 UTC, rikki cattermole wrote: You probably want[0] to allocate a class on the stack instead of doing this. [0] http://dlang.org/phobos/std_typecons.html#.scoped If I will use it I won't use @nogc. Is the only one case?

Delay allocating class instance in stack.

2017-03-21 Thread ANtlord via Digitalmars-d-learn
Hello! I read documentation about memory management and can't find description about delay allocation of instance. I have a method marked by @nogc. This method takes boolean variable. If this variable is true I want to construct object with one set of parameters else I want to construct object

Re: Delay allocating class instance in stack.

2017-03-21 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 08:46:43 UTC, Ali Çehreli wrote: Another option is std.conv.emplace: import std.conv : emplace; class MyClass { this(int) @nogc { } ~this() @nogc { } } void method(bool flag) @nogc { void[__traits(classInstanceSize, MyClass)] buffer = void;

Re: Delay allocating class instance in stack.

2017-03-22 Thread ANtlord via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 06:47:26 UTC, Ali Çehreli wrote: On 03/21/2017 09:57 PM, ANtlord wrote: > Thank you for clarification. But I have one more question. Do I have to > use destroy for deallocating object from stack? Yes because what is going out of scope are two things: - A buffer -

Re: Delay allocating class instance in stack.

2017-03-21 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 12:30:57 UTC, Stefan Koch wrote: Try scope obj = new MyClass(flag ? 1 : 2); In essence you should never need to delay construction. Just construct the object as soon as you have everything to construct it. which includes conditions. Yes I know it. I prepare all

Re: Interfacing C++ to D

2017-04-03 Thread ANtlord via Digitalmars-d-learn
On Sunday, 2 April 2017 at 16:03:51 UTC, FreeSlave wrote: Funny thing: If I replace interface with abstract class, it works as it should. Also I noticed that removing inheritance in library and in application makes unexpected results. When I try to output field `field` I get incorrect

Re: Interfacing C++ to D

2017-04-02 Thread ANtlord via Digitalmars-d-learn
On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote: On Saturday, 1 April 2017 at 16:39:28 UTC, FreeSlave wrote: This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS? My bad. I've tested example under caption Using C++ Classes From D. I

Re: Interfacing C++ to D

2017-04-02 Thread ANtlord via Digitalmars-d-learn
On Saturday, 1 April 2017 at 16:39:28 UTC, FreeSlave wrote: This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS? My bad. I've tested example under caption Using C++ Classes From D. I used several combinations of compilers, and no one works

Interfacing C++ to D

2017-04-01 Thread ANtlord via Digitalmars-d-learn
Hello! Can somebody give a relevant example shows how to use C++ classes in D? I've used the exmaple from https://dlang.org/spec/cpp_interface.html but I get a segmentation fault as result of D application. My application shows "Program exited with code -11" Thanks.

Re: Creating Tuple or AliasSeq

2017-04-07 Thread ANtlord via Digitalmars-d-learn
On Friday, 7 April 2017 at 07:46:40 UTC, Ali Çehreli wrote: Here is a solution: auto objectFactory(ObjectType, Args...)(Args args) { import std.algorithm : cartesianProduct, map; import std.array : array; return cartesianProduct(args).map!(a => ObjectType(a.expand)).array; }

Re: Creating Tuple or AliasSeq

2017-04-07 Thread ANtlord via Digitalmars-d-learn
On Friday, 7 April 2017 at 07:46:40 UTC, Ali Çehreli wrote: Here is a solution: auto objectFactory(ObjectType, Args...)(Args args) { import std.algorithm : cartesianProduct, map; import std.array : array; return cartesianProduct(args).map!(a => ObjectType(a.expand)).array; }

Creating Tuple or AliasSeq

2017-04-06 Thread ANtlord via Digitalmars-d-learn
Hello! I've got an issue related to making a Tuple or AliasSeq using income template arguments. I want to create template makes an array of objects from array of arrays have different sizes and different types of values. I created temporary solution. It is a concatenation of strings that

Exception handling

2017-07-14 Thread ANtlord via Digitalmars-d-learn
Hello! I've tried to use nothrow keyword and I couldn't get a state of function satisfied the keyword. I have one more method that can throw an exception; it is called inside nothrow method. Every type of an exception from the throwable method is handled by the nothow method. ubyte

Re: Exception handling

2017-07-15 Thread ANtlord via Digitalmars-d-learn
On Friday, 14 July 2017 at 20:22:21 UTC, Ali Çehreli wrote: On 07/14/2017 12:36 PM, ANtlord wrote: All you need is to catch Exception there as well: catch(Exception) { assert(false, "throwable_fn threw something unexpected"); } Ali Thank you, Ali! You answer for my

Understanding lvalue and rvalue

2017-04-27 Thread ANtlord via Digitalmars-d-learn
Hello! Short time ago I've met strange thing at least for me. I have a non-copyable structure and two methods for it with same name. I mean that I use function overloading. First method takes rvalue of this structure. Second method takes constant lvalue structure. But when I try to use this

Re: Understanding lvalue and rvalue

2017-04-27 Thread ANtlord via Digitalmars-d-learn
On Friday, 28 April 2017 at 04:46:00 UTC, ANtlord wrote: Does make sense for me because it is more obvious in client code, but I want to understand reason of error pointed above. Typo fix. It makes sense for me*

Re: Understanding lvalue and rvalue

2017-04-28 Thread ANtlord via Digitalmars-d-learn
On Friday, 28 April 2017 at 05:21:26 UTC, ag0aep6g wrote: Instead of removing `in`/`const` from the ref overload, you can also add it to the non-ref overload. Again, the overloads will have the same match level ("match with conversion to const"), and the ref version will win. It works. I

Re: Create class on stack

2017-08-07 Thread ANtlord via Digitalmars-d-learn
On Sunday, 6 August 2017 at 15:47:43 UTC, Moritz Maxeiner wrote: If you use this option, do be aware that this feature has been > scheduled for future deprecation [1]. It's likely going to continue working for quite a while (years), though. [1]

Garbage collection and closures.

2017-06-17 Thread ANtlord via Digitalmars-d-learn
Hello! I can't understand one thing related to closures and calling of GC. I have the following demo snippet, where a closure is passed to `receive` function in a loop. bool isDone = false; while(!isDone) receive((bool val){ isDone = val }); Is GC called every iteration of this loop?

Re: Garbage collection and closures.

2017-06-17 Thread ANtlord via Digitalmars-d-learn
On Saturday, 17 June 2017 at 13:13:17 UTC, Adam D. Ruppe wrote: On Saturday, 17 June 2017 at 13:03:28 UTC, ANtlord wrote: Is GC called every iteration of this loop? No, it will once on scope entry; where the deepest-referenced variable that is actually captured is defined. The compiler

Re: Garbage collection and closures.

2017-06-17 Thread ANtlord via Digitalmars-d-learn
On Saturday, 17 June 2017 at 17:15:50 UTC, Adam D. Ruppe wrote: On Saturday, 17 June 2017 at 14:19:34 UTC, ANtlord wrote: Excuse me, I can't get what does it mean "deepest-referenced". What the deep you mean? The deep of a closure or deep of the function where the variable is defined. Can you

Re: Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 07:48:35 UTC, ANtlord wrote: Hello! Is it possible to define associative array on top level of module? I try to compile this code and I get message `Error: non-constant expression ["s":"q", "ss":"qq"]` import std.stdio; auto dict = [ "s": "q", "ss":

Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
Hello! Is it possible to define associative array on top level of module? I try to compile this code and I get message `Error: non-constant expression ["s":"q", "ss":"qq"]` import std.stdio; auto dict = [ "s": "q", "ss": "qq" ]; void main() { writeln(val); } I solved

Re: Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 08:24:09 UTC, evilrat wrote: Making enum means that value should be available at compile time and AA's are fully dynamic. But if my memory serves me well, you can declare empty AA and delay initialization. So the closest solution is to move initialization of AA to

Re: Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 16:34:15 UTC, H. S. Teoh wrote: On Tue, May 02, 2017 at 02:37:20PM +, ANtlord via Digitalmars-d-learn wrote: On Tuesday, 2 May 2017 at 12:41:01 UTC, Jacob Carlborg wrote: > > Note that when declared as "enum", all places it's > referenced, a ne

Re: Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 07:48:35 UTC, ANtlord wrote: Hello! Is it possible to define associative array on top level of module? I try to compile this code and I get message `Error: non-constant expression ["s":"q", "ss":"qq"]` import std.stdio; auto dict = [ "s": "q", "ss":

Re: Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 14:37:20 UTC, ANtlord wrote: On Tuesday, 2 May 2017 at 12:41:01 UTC, Jacob Carlborg wrote: Note that when declared as "enum", all places it's referenced, a new associative array will be allocated. If it is allocated at all places I can move initialization to

Re: Top level associative arrays

2017-05-02 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 12:41:01 UTC, Jacob Carlborg wrote: Note that when declared as "enum", all places it's referenced, a new associative array will be allocated. If it is allocated at all places I can move initialization to module ctor as says evilrat but how can I make an immutable

struct/class generation

2017-10-11 Thread ANtlord via Digitalmars-d-learn
Hello dear community! I've met a little issue. How can I generate struct or class copying some fields and methods from another struct or class? I've found methods to get fields. They are std.traits.FieldNameTuple and std.traits.FieldTypeTuple but I can't find a method allows getting methods

How to use containers in lock based concurrency

2017-11-03 Thread ANtlord via Digitalmars-d-learn
Hello! I can't get how to use double linked list in concurrency. Please help. Providing code import std.stdio; import std.container; synchronized class SocksQueue { private shared(DList!string) _queue; public void f(string data) { this._queue.insertFront(data); } } void

Re: UFCS syntax I never saw before.

2018-05-21 Thread ANtlord via Digitalmars-d-learn
On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote: After all this time I saw this: writeln = iota = 5; what?? I never saw that before! This is interesting, there is something useful that i can do with this kind of call? What the hell is this? I don't figure out why are there so many

Re: UFCS syntax I never saw before.

2018-05-22 Thread ANtlord via Digitalmars-d-learn
On Monday, 21 May 2018 at 18:53:19 UTC, Jonathan M Davis wrote: On Monday, May 21, 2018 14:00:55 ANtlord via Digitalmars-d-learn wrote: If someone wrote an good DIP on the subject, I expect that things could be accelerated, but it's not much a real paint point in practice, and the chances

DerelictVorbis and string pointer

2018-06-23 Thread ANtlord via Digitalmars-d-learn
Hello D community! I'm developing an application that must work on audio especially playback Ogg files. So I took library DerelictVorbis [0] testing basic functions like `ov_fopen`. The tests were successful so I decided to implement core components of the application using D and Derelict

Re: DerelictVorbis and string pointer

2018-06-23 Thread ANtlord via Digitalmars-d-learn
On Sunday, 24 June 2018 at 01:54:52 UTC, Nicholas Wilson wrote: On Sunday, 24 June 2018 at 01:43:41 UTC, ANtlord wrote: On Sunday, 24 June 2018 at 01:26:48 UTC, ANtlord wrote: Actually I get it worked replacing `string filepath2` by `char[] filepath2` but filepath is string still and it

Re: DerelictVorbis and string pointer

2018-06-23 Thread ANtlord via Digitalmars-d-learn
On Sunday, 24 June 2018 at 01:26:48 UTC, ANtlord wrote: Actually I get it worked replacing `string filepath2` by `char[] filepath2` but filepath is string still and it works correctly. It doesn't work

Return value in BetterC mode.

2018-02-17 Thread ANtlord via Digitalmars-d-learn
Hello! Yesterday I found an interesting issue for myself while I was implementing unique pointer for my project in BetterC. When I was trying to return new instance from a `move` method I got calling of destructor the instance. When the instance is out of scope the calling is happens again. I

Windows 7 x64. Prevent appearing of console with GUI application

2018-07-24 Thread ANtlord via Digitalmars-d-learn
Hello! I'm trying run my GUI application getting a console hidden. The application is on top of GTKD, compiled with dmd 2.081.1 in Windows 7 x64. I read a few threads on the forum and StackOverflow and I got that I need to add a module definition file [1] or to add -L/SUBSYSTEM:WINDOWS

Re: Windows 7 x64. Prevent appearing of console with GUI application

2018-07-24 Thread ANtlord via Digitalmars-d-learn
On Tuesday, 24 July 2018 at 09:20:22 UTC, Mike Parker wrote: On Tuesday, 24 July 2018 at 08:09:33 UTC, ANtlord wrote: Anyway, if you are using OPTLINK or the MS Linker, try a test program without gtkD to make sure it works standalone for you. ``` import core.sys.windows.windows; void main()

importPaths option in dub

2018-03-27 Thread ANtlord via Digitalmars-d-learn
Hello! I work using Linux. Is it possible to use environment variables like $HOME in option importPaths of Dub project file? I tried it but dub concatenates the path and current path so I get something like this /develop/project/$HOME/.dub/packages/gtk-d/generated/gtkd or

Global hotkey with GTK based application under Windows

2018-04-01 Thread ANtlord via Digitalmars-d-learn
Hello! I implement a GTK-D based application for Windows and Linux. In case of Linux there isn't any problem, I use binding[1] for libkeybinder. In case of Windows I can't find convinient way to implement global shortcuts. There is a way to get it done is use of WinAPI but it's not convinient

Building Derelict based application under windows

2018-03-22 Thread ANtlord via Digitalmars-d-learn
Hello! First of all I don't know what my problem is but please don't close the thread and give me a chance. I have been working on DMD under Linux since I met D. Short time ago I got a reason to make an application for Windows. I took DerelictAL[1], DerelictOgg[2] and DerelictVorbis[3]

Re: Building Derelict based application under windows

2018-03-23 Thread ANtlord via Digitalmars-d-learn
On Friday, 23 March 2018 at 01:18:02 UTC, Mike Parker wrote: On Thursday, 22 March 2018 at 20:51:36 UTC, ANtlord wrote: Thanks in advance. Please feel free to ask any question Your errors with the derelict libs are linker errors, with the early ones being this one: "warning LNK4003:

GTKD release event in windows

2018-06-24 Thread ANtlord via Digitalmars-d-learn
Hello! Has somebody ever encountered continually triggering of key released event while the key is pressed with GTKD? I have the same issue for key pressed event but it's not so critical for me. The problem is occurred for all key keys except a key-modifier like alt, ctrl and shift. Also, it

Get variables with call stack

2018-09-21 Thread ANtlord via Digitalmars-d-learn
Hello! I need to make a some sort of error report system for an application. I want to catch base Exception class instance and report call stack and with the call stack I want to report all variables with their values. There are a couple of services that make report using call stack and

Re: this is null

2019-03-10 Thread ANtlord via Digitalmars-d-learn
On Sunday, 10 March 2019 at 14:25:56 UTC, spir wrote: There is a typo in this instruction: T* ptr = this.list.getFisrtFreeOrAdd(memViewLen).getPtr!T(); ^^ rs (may this explain your null? the compiler should complain) diniz Good catch! But I

this is null

2019-03-09 Thread ANtlord via Digitalmars-d-learn
Hello everyone! I've encountered the problem which I already encountered before. Unfortunately, I had no time in the previous time to report and to talk about it. So I decided to play making my own "malloc" function in pure D (betterC) at this time. And I encountered the issue one more time.

Re: this is null

2019-03-09 Thread ANtlord via Digitalmars-d-learn
On Saturday, 9 March 2019 at 20:04:53 UTC, Paul Backus wrote: struct S { bool isThisNull() { return is null; } } void main() { import.std.stdio; S* p = null; writeln((*p).isThisNull); // true } Interactive version: https://run.dlang.io/is/fgT2rS Anyway, thank you! I didn't

Re: this is null

2019-03-09 Thread ANtlord via Digitalmars-d-learn
On Saturday, 9 March 2019 at 20:04:53 UTC, Paul Backus wrote: You can end up with a null `this` reference if you dereference a null pointer to a struct and then call a method on the result. For example: I can but my reference is not null before calling. Take a look at the line of code

Re: this is null

2019-03-09 Thread ANtlord via Digitalmars-d-learn
On Saturday, 9 March 2019 at 21:00:51 UTC, Ali Çehreli wrote: I haven't run the code but which pointer is null? Try adding I mean `this` by "this" word. You can see that `this` is null if you run gdb and before that line make `p/x this` [0] this check as well: auto node =