Re: std.file: read, readText and UTF-8 decoding

2023-09-22 Thread Uranuz via Digitalmars-d-learn
OK. Thanks for response. I wish that there it was some API to handle it "out of the box". Do I need to write some issue or something in order to not forget about this?

Re: std.file: read, readText and UTF-8 decoding

2023-09-21 Thread Uranuz via Digitalmars-d-learn
Addition: Current solution to this problemme that I was found is: So I just check for BOM manually. Get length of bom.sequence and remove that count of items from beginning. But I dont' think that it's convenient solution, because `who knows` how much else issues with UTF could happend. And I

std.file: read, readText and UTF-8 decoding

2023-09-21 Thread Uranuz via Digitalmars-d-learn
Hello! I have some strange problem. I am trying to parse XML files and extract some information from it. I use library dxml for it by Jonathan M Davis. But I have a probleme that I have multiple XML files made by different people around the world. Some of these files was created with Byte

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

2021-11-20 Thread uranuz via Digitalmars-d-announce
On Wednesday, 17 November 2021 at 11:00:46 UTC, JN wrote: 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

Re: Why Throwable.message is not a property

2021-03-17 Thread uranuz via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 19:38:48 UTC, Adam D. Ruppe wrote: On Wednesday, 17 March 2021 at 19:32:02 UTC, uranuz wrote: Seems that a problem with concatenation is because Throwable.message has const(char)[] type, but not string. This makes some inconvenience ;-) Yes, that's what I

Re: Why Throwable.message is not a property

2021-03-17 Thread uranuz via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 17:52:20 UTC, Adam D. Ruppe wrote: On Wednesday, 17 March 2021 at 17:46:27 UTC, uranuz wrote: Also because it is not a property in some contexts when I try to concatenate it with string without parentheses using "~" operator it fails Can you post some sample

Why Throwable.message is not a property

2021-03-17 Thread uranuz via Digitalmars-d-learn
The question is why Throwable.message is not a @property?! It looks strange now, because "message" is not a *verb*, but a *noun*. So it's expected to be a property. Also because it is not a property in some contexts when I try to concatenate it with string without parentheses using "~"

Re: Release D 2.090.0

2020-02-29 Thread uranuz via Digitalmars-d-announce
I have just added workaround of this bug in by code. And now it is working and returns backtrace string[] getBacktrace(Throwable ex) { import std.conv: to; import core.exception: OutOfMemoryError; string[] backTrace; try { foreach( inf; ex.info )

Re: Release D 2.090.0

2020-02-29 Thread uranuz via Digitalmars-d-announce
I believe that problemme is somehow connected with core.runtime.DefaultTraceInfo. I figured out that it fail inside a function that tries to get trace info for exception. Body is pretty simple. I created the case where `ex` is just an instance of standart Exception class in order to eliminate

Re: Release D 2.090.0

2020-02-25 Thread uranuz via Digitalmars-d-announce
Seems that I managed to slightly reduce the problemme. I suspect that error is somehow connected with running my code inside TaskPool: https://dlang.org/library/std/parallelism/task_pool.html `Memory allocation failed` error occurs when I throw any exception even trivial one: throw new

Re: Difference between range `save` and copy constructor

2020-02-17 Thread uranuz via Digitalmars-d-learn
> Either way, generic code should never be using a range after > it's been copied, and copying is a key part of how > idiomatic, range-based code works in D. OK. Thanks for instructions. I shall give it a try.

Re: Difference between range `save` and copy constructor

2020-02-16 Thread uranuz via Digitalmars-d-learn
On Sunday, 16 February 2020 at 12:38:51 UTC, Jonathan M Davis wrote: On Sunday, February 16, 2020 3:41:31 AM MST uranuz via Digitalmars-d-learn wrote: I have reread presentation: http://dconf.org/2015/talks/davis.pdf We declare that `pure` input range cannot be `unpoped` and we can't return

Re: Difference between range `save` and copy constructor

2020-02-16 Thread uranuz via Digitalmars-d-learn
In general for value-semantics and ref-semantics the different code is actually needed. But generic algorithm try to pretend that the logic is the same. But it's not true. But in wide subset of trivial algorithm it's true. So it's incorrectly interpolated that it's true for every case. The

Re: Difference between range `save` and copy constructor

2020-02-16 Thread uranuz via Digitalmars-d-learn
It's very bad. Because there seem that when I use range based algorithm I need to take two things into account. The first is how algrorithm is implemented. If it creates copies of range inside or pass it by reference. And the second is how the range is implemented if it has value or reference

Re: Difference between range `save` and copy constructor

2020-02-16 Thread uranuz via Digitalmars-d-learn
I have reread presentation: http://dconf.org/2015/talks/davis.pdf We declare that `pure` input range cannot be `unpoped` and we can't return to the previous position of it later at the time. So logically there is no sence of copying input range at all. So every Phobos algorithm that declares

Re: Difference between range `save` and copy constructor

2020-02-16 Thread uranuz via Digitalmars-d-learn
Also I see the problemme that someone can think that it creates an input range, because he doesn't provide `save` method, but actually it creates forward range unexpectedly, because it is copyable. And it makes what is actually happening in code more difficult. Some algrorithm can take ranges

Re: Difference between range `save` and copy constructor

2020-02-16 Thread uranuz via Digitalmars-d-learn
Actually, as I understand it, the main reason that save was introduced was so that classes could be forward ranges I have use of ranges as a classes in my code that rely on classes and polymorthism, but it's usually an InputRange that implements Phobos interface:

Difference between range `save` and copy constructor

2020-02-15 Thread uranuz via Digitalmars-d-learn
I am interested in current circumstances when we have new copy constructor feature what is the purpose of having range `save` primitive? For me they look like doing basicaly the same thing. And when looking in some source code of `range` module the most common thing that `save` does is that it

Re: D create many thread

2020-02-06 Thread uranuz via Digitalmars-d-learn
Is it also possible to set some custom thread name for GC threads in order to be distinguishable from other threads in utilities like `htop`? It would be handy...

Re: Question about alias and getOverloads

2020-02-01 Thread uranuz via Digitalmars-d-learn
OK. Thanks. Created two reports related to these questions: https://issues.dlang.org/show_bug.cgi?id=20553 https://issues.dlang.org/show_bug.cgi?id=20555

Re: Question about alias and getOverloads

2020-01-30 Thread uranuz via Digitalmars-d-learn
I apologise that I need to revive this discussion again. But still I got answer to only one of my questions. I know that it is a common practice in programmers society that when someone asks more than 1 question. Then people who answer them usually choose only one of these questions that is

Re: Question about alias and getOverloads

2020-01-28 Thread uranuz via Digitalmars-d-learn
I have read it two or three times just before writing my question: https://dlang.org/spec/declaration.html#alias And also a have read all the dlang docs several time few years ago... ;) But I don't see what do you you mean by writing that it was menioned here. I don't se any words or any

Re: Question about alias and getOverloads

2020-01-28 Thread uranuz via Digitalmars-d-learn
Thanks for advice ;) This looks like some `standard trick` that is yet not learnt or forgoten by me personally. The key was in using `parent` trait. This is what I failed to think of. This is working as expected: //- import std; import core.thread; import std.meta: AliasSeq; void

Question about alias and getOverloads

2020-01-28 Thread uranuz via Digitalmars-d-learn
Hello! I have a question about `alias` template parameter and getOverloads. For instance I have some code like this: // - import std; import core.thread; void foo(string param1) {} void foo(string param1, int param2) {} template Bar(alias Func) { // Next line is not valid now. This is

Re: Release D 2.090.0

2020-01-14 Thread uranuz via Digitalmars-d-announce
I have installed 2.089 back to check. And in the previous version there is no such error. I have tried to debug. And looks like this error occurred during throwing exception inside std.exception: enforce.

Re: Release D 2.090.0

2020-01-14 Thread uranuz via Digitalmars-d-announce
On Tuesday, 7 January 2020 at 10:30:09 UTC, Martin Nowak wrote: Glad to announce D 2.090.0, ♥ to the 48 contributors. This release comes with the ability to convert lazy parameters to delegates, new intrinsics to force rounding to specific floating point precision, unittest builds that no

Re: Release D 2.090.0

2020-01-14 Thread uranuz via Digitalmars-d-announce
On Tuesday, 7 January 2020 at 10:30:09 UTC, Martin Nowak wrote: Glad to announce D 2.090.0, ♥ to the 48 contributors. This release comes with the ability to convert lazy parameters to delegates, new intrinsics to force rounding to specific floating point precision, unittest builds that no

Re: Some code that compiles but shouldn't

2019-12-30 Thread uranuz via Digitalmars-d-learn
On Monday, 30 December 2019 at 19:09:13 UTC, MoonlightSentinel wrote: On Monday, 30 December 2019 at 18:18:49 UTC, uranuz wrote: So as you see I have added a lot of enforce to test if all variables are not null. But nothing was null and the reason of segfault were unclear. What about

Re: Some code that compiles but shouldn't

2019-12-30 Thread uranuz via Digitalmars-d-learn
On Monday, 30 December 2019 at 19:09:13 UTC, MoonlightSentinel wrote: On Monday, 30 December 2019 at 18:18:49 UTC, uranuz wrote: So as you see I have added a lot of enforce to test if all variables are not null. But nothing was null and the reason of segfault were unclear. What about

Some code that compiles but shouldn't

2019-12-30 Thread uranuz via Digitalmars-d-learn
I have created library/ framework to handle JSON-RPC requests using D methods. I use some *template magic* to translate JSON-RPC parameters and return values from/ and to JSON. And I have encountered funny bug that at first was hard to find. My programme just segfaulted when call to this

Re: release of code-d 0.21.0 + serve-d 0.5.1

2019-11-18 Thread uranuz via Digitalmars-d-announce
Hello! When code-d attempts self upgrade it prints the followinf output to console of VS Code: """ Installing DCD: DCD is outdated. Expected: 0.11.1, got none Downloading from https://github.com/dlang-community/DCD/releases/download/v0.11.1/dcd-v0.11.1-linux-x86_64.tar.gz to

Re: Beta 2.088.1

2019-10-06 Thread uranuz via Digitalmars-d-announce
On Friday, 4 October 2019 at 05:58:03 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.088.1 point release, ♥ to the 6 contributors. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.088.1.html As usual please report any bugs at https://issues.dlang.org

Re: Release D 2.087.0

2019-07-07 Thread uranuz via Digitalmars-d-announce
On Sunday, 7 July 2019 at 10:09:50 UTC, Johannes Pfau wrote: Am Sun, 07 Jul 2019 08:06:57 + schrieb uranuz: After updating compiler to 2.087 I got a lot of deprecation warnings linked to std.json module. I have found all of the usages of deprecated symbols in my project and changed them

Re: Release D 2.087.0

2019-07-07 Thread uranuz via Digitalmars-d-announce
After updating compiler to 2.087 I got a lot of deprecation warnings linked to std.json module. I have found all of the usages of deprecated symbols in my project and changed them to the new ones. All these warnings are about changing JSON_TYPE to JSONType JSON_TYPE.STRING to JSONType.string

Re: isInputRange is false for non-copyable types

2018-04-20 Thread Uranuz via Digitalmars-d
foreach(ref e; range) { } On idea is to have `ref` foreach to say that you would like to iterate your range without copying. The syntax could be: foreach(e; ref range) { } or: ref foreach(e; range) { } At least it will not break existing code. But this means that in each case you should

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 18:19:34 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 18:10:30 UTC, Uranuz wrote: What is a good practice to make a bug report if I can't give some reduced case when problem occurs? Is it normal to just put link to my repo and branch with this problem

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 17:47:18 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 17:41:49 UTC, Uranuz wrote: On Saturday, 25 March 2017 at 17:31:33 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 13:34:43 UTC, Uranuz wrote: [...] I can reproduce this. The function which

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 17:31:33 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 13:34:43 UTC, Uranuz wrote: On Saturday, 25 March 2017 at 07:57:11 UTC, Stefan Koch wrote: [...] If you wish to help. You are welcome) I created branch in my repository

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 07:57:11 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 06:56:40 UTC, Uranuz wrote: After changes in my project tried to compile, but compiler failed. Running dmd under GDB gives the following: Program received signal SIGSEGV, Segmentation fault.

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 08:24:04 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 08:13:08 UTC, Uranuz wrote: On Saturday, 25 March 2017 at 07:57:11 UTC, Stefan Koch wrote: [...] I just put debug messages on every `assert` and figured out it fails on lines:

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 07:57:11 UTC, Stefan Koch wrote: On Saturday, 25 March 2017 at 06:56:40 UTC, Uranuz wrote: After changes in my project tried to compile, but compiler failed. Running dmd under GDB gives the following: Program received signal SIGSEGV, Segmentation fault.

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 06:56:40 UTC, Uranuz wrote: After changes in my project tried to compile, but compiler failed. Running dmd under GDB gives the following: Program received signal SIGSEGV, Segmentation fault. 0x005807a0 in Mangler::mangleFuncType(TypeFunction*,

Re: Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 March 2017 at 06:56:40 UTC, Uranuz wrote: After changes in my project tried to compile, but compiler failed. Running dmd under GDB gives the following: Program received signal SIGSEGV, Segmentation fault. 0x005807a0 in Mangler::mangleFuncType(TypeFunction*,

Got compiler crash in Mangler::mangleFuncType

2017-03-25 Thread Uranuz via Digitalmars-d
After changes in my project tried to compile, but compiler failed. Running dmd under GDB gives the following: Program received signal SIGSEGV, Segmentation fault. 0x005807a0 in Mangler::mangleFuncType(TypeFunction*, TypeFunction*, unsigned char, Type*) () Could someone give me adivice

Re: How to make rsplit (like in Python) in D

2016-10-03 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 18:33:02 UTC, TheFlyingFiddle wrote: On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: [...] There are two reasons why this does not compile. The first has to do with how retro() (and indeed most function in std.range) work with utf-8 strings (eg the

Re: How to make rsplit (like in Python) in D

2016-10-03 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 18:55:54 UTC, pineapple wrote: On Saturday, 1 October 2016 at 17:55:08 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 17:32:59 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: [...] But these example fails. Oops. Looks like a

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 17:32:59 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: [...] But these example fails. Oops. Looks like a bug( import std.stdio; import std.algorithm; import std.range; import std.string; [...] I created bug report on this:

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to process range from the back. Is `back` and `popBack` somehow

How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to process range from the back. Is `back` and `popBack` somehow worse than `front` and `popFront`. I've tried to write

Re: How to check member function for being @disable?

2016-09-13 Thread Uranuz via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 15:32:57 UTC, Jonathan M Davis wrote: On Tuesday, September 13, 2016 08:28:10 Jonathan M Davis via Digitalmars-d- learn wrote: On Tuesday, September 13, 2016 04:58:38 Uranuz via Digitalmars-d-learn wrote: > In my code I iterate in CT over class methods mar

How to check member function for being @disable?

2016-09-12 Thread Uranuz via Digitalmars-d-learn
In my code I iterate in CT over class methods marked as @property and I have a probleme that one of methods is @disable. So I just want to skip @disable members. I found possible solution, but it's interesting to we if we have more clear and obvious way to test for @disable without using

code.dlang.org 500 Internal Server Error

2016-09-01 Thread Uranuz via Digitalmars-d
code.dlang.org 500 Internal Server Error Does anyone experience the same probleme?

Re: static immutable and lambdas inside struct or class. Is that bug or not?

2016-08-14 Thread Uranuz via Digitalmars-d-learn
On Sunday, 14 August 2016 at 15:53:21 UTC, ag0aep6g wrote: On 08/14/2016 04:27 PM, Uranuz wrote: [...] Looks like a compiler bug, since it works without the struct: import std.algorithm: map; import std.array: array; import std.typecons: tuple; immutable aaa = [ tuple("1",

static immutable and lambdas inside struct or class. Is that bug or not?

2016-08-14 Thread Uranuz via Digitalmars-d-learn
Greatings! I need help with these lines bellow. I don't understand why it doesn't compile. Is it bug somewhere in Phobos or compiler? Or just I wrote smth wrong? //- struct A { import std.algorithm: map; import std.array: array; import std.typecons: tuple;

Re: static if enhancement

2016-06-25 Thread Uranuz via Digitalmars-d
On Saturday, 25 June 2016 at 10:19:47 UTC, Claude wrote: On Friday, 24 June 2016 at 15:24:48 UTC, Andrei Alexandrescu wrote: Does anyone else find this annoying? https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei My 2 cents. I don't find that annoying at all. It's perfectly normal

Re: static if enhancement

2016-06-25 Thread Uranuz via Digitalmars-d
On Friday, 24 June 2016 at 15:24:48 UTC, Andrei Alexandrescu wrote: Does anyone else find this annoying? https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei What I think about enchancement of static if is that it could be interesting to have `elif` keyword like in Python, so instead of

Problem with circular imports of modules with static ctors an immutable variables

2016-04-14 Thread Uranuz via Digitalmars-d-learn
In my program I have error with circular imports of modules with static ctors. So I decided to move ctors in separate file and import it only from the 1st file. But problem is that in the first file I have immutables that should be initialized in shared static ctor. However doing it from

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-10 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 21:16:08 UTC, ag0aep6g wrote: On Saturday, 9 April 2016 at 19:31:31 UTC, Uranuz wrote: I think that we need to add warning about such case in documentation section: https://dlang.org/spec/hash-map.html#construction_and_ref_semantic in order to prevent this kind of

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:25:32 UTC, Uranuz wrote: On Saturday, 9 April 2016 at 18:27:11 UTC, ag0aep6g wrote: [...] Another observation is illustrated with the foloving code: http://dpaste.dzfl.pl/8d68fd5922b7 Because AA and arrays are not created before they were assigned some value

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 18:27:11 UTC, ag0aep6g wrote: On Saturday, 9 April 2016 at 18:06:52 UTC, Uranuz wrote: Thanks. It's clear now. AA holds not `array struct` itself inside, but pointer to it. How the array is stored in the AA doesn't matter, as far as I can see. The point is that

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 16:44:06 UTC, ag0aep6g wrote: On 09.04.2016 18:13, Uranuz wrote: http://dpaste.dzfl.pl/523781df67ab For reference, the code: import std.stdio; void main() { string[][string] mapka; string[]* mapElem = "item" in mapka; //Checking if I

Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
I am stupid today :) So I have a question. The piece of code given: http://dpaste.dzfl.pl/523781df67ab It looks good, but I don't understand why it works?

Re: Why is this not a warning?

2016-03-19 Thread Uranuz via Digitalmars-d
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh wrote: Please consider the following program, which is a reduced version of a problem I've spent the entire of today trying to debug: import std.stdio; void main() { enum ulong MAX_VAL = 256; long value = -500; if(

Need some help about error that I don't understand

2016-02-05 Thread Uranuz via Digitalmars-d-learn
In my custom multithreaded web-server (non vibe-based) I got error that is strange for me. I've was looking for a reason running app under GDB, but I don't understand how to interpret what I've got. It's interesting that it fails (without any error or segfault message) in the case when null

Re: Need some help about error that I don't understand

2016-02-05 Thread Uranuz via Digitalmars-d-learn
On Friday, 5 February 2016 at 17:39:55 UTC, Uranuz wrote: In my custom multithreaded web-server (non vibe-based) I got error that is strange for me. I've was looking for a reason running app under GDB, but I don't understand how to interpret what I've got. It's interesting that it fails

Re: [dlang.org] new forum design

2016-01-18 Thread Uranuz via Digitalmars-d
On Monday, 18 January 2016 at 10:20:13 UTC, Vladimir Panteleev wrote: As the new design rolled out on dlang.org, I decided to push the changes on forum.dlang.org as well. From what I gathered from the previous feedback thread, I believe we've addressed the most stringent issues. Once again

Question about OutputRange and std.range: put

2016-01-16 Thread Uranuz via Digitalmars-d-learn
Hello to forum readers! I have a question about using OutputRange and std.range: put. I have the following code snippet to illustrate my question: import std.range, std.stdio, std.string; void main() { string greating = "Hello, " ; string username = "Bob";

Re: Question about OutputRange and std.range: put

2016-01-16 Thread Uranuz via Digitalmars-d-learn
On Saturday, 16 January 2016 at 16:14:56 UTC, Jonathan M Davis wrote: On Saturday, January 16, 2016 12:11:11 Uranuz via Digitalmars-d-learn wrote: [...] There are a few problems here. First off, when put is used with an array, it fills the array. It doesn't append to it. So, you can't use

Re: Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread Uranuz via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 07:34:15 UTC, Mike Parker wrote: On Wednesday, 2 September 2015 at 06:28:52 UTC, Uranuz wrote: As far as I understand to save current cursor of forward range I should always use *save* property. But sometimes range struct is just copied using postblit without

Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread Uranuz via Digitalmars-d-learn
As far as I understand to save current cursor of forward range I should always use *save* property. But sometimes range struct is just copied using postblit without using save (it happens even in Phobos). Is it correct behaviour to *pass ownership* for range structs via just copying of range

Re: Voting for std.experimental.allocator

2015-07-16 Thread Uranuz via Digitalmars-d-announce
On Thursday, 16 July 2015 at 10:02:17 UTC, Dicebot wrote: On Wednesday, 8 July 2015 at 11:33:03 UTC, Dicebot wrote: Voting ends in 2 weeks, on July 22. ~1 week remains Yes. It's time to have this functionality in standart library.

Re: Proof of concept - library AA

2015-07-08 Thread Uranuz via Digitalmars-d
On Wednesday, 8 July 2015 at 08:24:00 UTC, Martin Nowak wrote: On Wednesday, 8 July 2015 at 06:11:25 UTC, Uranuz wrote: My idea is slihtly of topic. I thiking about some API for array and associative array literals. There is already an API for array literals, typesafe variadic arguments.

Re: Proof of concept - library AA

2015-07-08 Thread Uranuz via Digitalmars-d
On Saturday, 30 May 2015 at 08:22:21 UTC, Martin Nowak wrote: On Saturday, 30 May 2015 at 00:50:39 UTC, Steven Schveighoffer wrote: I suggest first we build a library AA that sits beside real AA, even if it doesn't . Then we create a test suite to prove that the library AA can be a drop in

Re: Passing reference data to class and incapsulation

2014-11-28 Thread Uranuz via Digitalmars-d-learn
On Friday, 28 November 2014 at 08:31:26 UTC, bearophile wrote: Uranuz: Same situation happens when I assign reference data to properties. Someone has suggested to solve this problem with an attribute, like owned, that forbids to return mutable reference data owned by a class/struct

Passing reference data to class and incapsulation

2014-11-27 Thread Uranuz via Digitalmars-d-learn
In D we a several data types which are passed by reference: dynamic arrays, associative arrays. And sometimes we need to pass these reference data to class instance to store it inside. One of the principles of object-oriented programming is incapsulation. So all class data should be only

Re: GC: memory collected but destructors not called

2014-11-12 Thread Uranuz via Digitalmars-d
If we will have something like *scoped destructor* (that will be executed at scope exit) could it help to release some resources? I worry about this problem too because even using class to hold resource I expirience some *delays* in relesing them. For example I have database connection opened.

Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName = Node!(string).Name; alias MyAttr = Node!(string).Attr; }

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
Looks like compiler looks for Node, Name and Attr in Node struct, because of eponymous thing. I understand it but I want to know if it is documented behaviour or not. Could anybody clear what happens with eponymous stuff and why I can't get acces to *other* declarations inside eponymous

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
I think it's the intended behavior. I think documentation is outdated. Ali Thanks. So I will modify my programme to workaround this.

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
Also I failed to find any documentation about eponymous stuff in language reference. As far as I remember it was here but now looks like it is missing.

Representing parse tree node

2014-11-02 Thread Uranuz via Digitalmars-d-learn
Now I'm working on implementation of Jinja template engine for web development on D language. http://jinja.pocoo.org I like it's explicit but still rather short syntax inherited from Python. I find it good for writing templates for web pages and other stuff such as configs or maybe CSS

Re: How to check i

2014-10-17 Thread Uranuz via Digitalmars-d-learn
This is

Re: How to match string by word

2014-10-17 Thread Uranuz via Digitalmars-d-learn
I haven't touched any key on a keyboard and haven't pressed *Send* but message was posted somehow. Thanks. Checking for UTF-8 continuation bytes is good idea. Also I agree that UTF-16 is more difficult. I will keep it for future release when implementation will start to work properly on UTF-8

How to check i

2014-10-16 Thread Uranuz via Digitalmars-d-learn
I have some string *str* of unicode characters. The question is how to check if I have valid unicode code point starting at code unit *index*? I need it because I try to write parser that operates on string by *code unit*. If more precisely I trying to write function *matchWord* that should

Re: compile time configurations

2014-10-11 Thread Uranuz via Digitalmars-d
I did something similar a while back. It parsed a .ini that contained default values and created a statically typed runtime parser for the actual .ini file from it. It was fun, to see that you can do that with D. Yes. I use import('filename') to configure my application too. I have

Why this doesn't compile?

2014-10-11 Thread Uranuz via Digitalmars-d
When I want to pass generic String by const reference I get an error. As far as I understand const should accept both mutable and immutable data. And there I want to pass it by reference. Is it possible? Or is there any reason why it is not? Is it a bug? void doSmth(String)(ref const(String)

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread Uranuz via Digitalmars-d-learn
Have a look here [1]. For example, if you have a byte that is between U+0080 and U+07FF you know that you need two bytes to get that whole code point. [1] http://en.wikipedia.org/wiki/UTF-8#Description Thanks. I solved it myself already for UTF-8 encoding. There choosed approach with

How to detect start of Unicode symbol and count amount of graphemes

2014-10-05 Thread Uranuz via Digitalmars-d-learn
I have struct StringStream that I use to go through and parse input string. String could be of string, wstring or dstring type. I implement function popChar that reads codeUnit from Stream. I want to have *debug* mode of parser (via CT switch), where I could get information about lineIndex,

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-05 Thread Uranuz via Digitalmars-d-learn
You can use std.uni.byGrapheme to iterate by graphemes: http://dlang.org/phobos/std_uni.html#.byGrapheme AFAIK, graphemes are not self synchronizing, but codepoints are. You can pop code units until you reach the beginning of a new codepoint. From there, you can iterate by graphemes, though

Re: RFC: moving forward with @nogc Phobos

2014-09-29 Thread Uranuz via Digitalmars-d
auto p1 = setExtension(hello, .txt); // fine, use gc auto p2 = setExtension!gc(hello, .txt); // same auto p3 = setExtension!rc(hello, .txt); // fine, use rc So by default it's going to continue being business as usual, but certain functions will allow passing in a (defaulted) policy for memory

Re: Creeping Bloat in Phobos

2014-09-28 Thread Uranuz via Digitalmars-d
On Sunday, 28 September 2014 at 00:13:59 UTC, Andrei Alexandrescu wrote: On 9/27/14, 3:40 PM, H. S. Teoh via Digitalmars-d wrote: If we can get Andrei on board, I'm all for killing off autodecoding. That's rather vague; it's unclear what would replace it. -- Andrei I believe that removing

Re: Creeping Bloat in Phobos

2014-09-28 Thread Uranuz via Digitalmars-d
I totally agree with all of that. It's one of those cases where correct by default is far too slow (that would have to be graphemes) but fast by default is far too broken. Better to force an explicit choice. There is no magic bullet for unicode in a systems language such as D. The

Re: Creeping Bloat in Phobos

2014-09-28 Thread Uranuz via Digitalmars-d
It's Tolstoy actually: http://en.wikipedia.org/wiki/War_and_Peace You don't need byGrapheme for simple DSL. In fact as long as DSL is simple enough (ASCII only) you may safely avoid decoding. If it's in Russian you might want to decode. Even in this case there are ways to avoid decoding, it

Re: RFC: reference counted Throwable

2014-09-20 Thread Uranuz via Digitalmars-d
I'm quite a noobie in memory models but from position of user of D language I have some ideas about syntax of switching between memory models. I think that having everywhere declarations using wrapper structs (like RefCounted) is not very user-friendly. But still we need some way to say to

Re: RFC: reference counted Throwable

2014-09-20 Thread Uranuz via Digitalmars-d
Also it's interesting waht is the correspondence between memory management, memory model and allocators? I know that std.allocator is in development. I guess that it should be considered in complex.

Re: sdlang-d can not link after updating to dmd 2.066

2014-08-29 Thread Uranuz via Digitalmars-d-learn
On Thursday, 28 August 2014 at 10:16:15 UTC, Puming wrote: I updated dub to 0.9.22 and still got the same error... THis is the output of `dub build --force`: --- output --- ## Warning for package sdlang-d ## The following compiler flags have been specified in the package description file.

Re: An idiom for disabling implicit conversions

2014-08-27 Thread Uranuz via Digitalmars-d
On Tuesday, 26 August 2014 at 18:29:49 UTC, Uranuz wrote: On Tuesday, 26 August 2014 at 16:48:08 UTC, Timon Gehr wrote: On 08/26/2014 05:46 PM, Uranuz wrote: In the pre-last paragraph please read text^ Also notice that C is language with weak type system but D is declared to have type system.

Re: An idiom for disabling implicit conversions

2014-08-26 Thread Uranuz via Digitalmars-d
I revived this topic, because I have similar problem but with additional requirements. I have interface and some classes that inherits from it. Also I have property two overloads of *set* properties with types int and Nullable!int There is listing of code that illustrates funny bug that I

Re: An idiom for disabling implicit conversions

2014-08-26 Thread Uranuz via Digitalmars-d
OK. Nobody ansvered anything yet. So I was thinking about this problem for a while so I figured out possible soulution. What I can do in this situation in to forbid these opertions and make compiler issue an error during compilation or implement functionality for all types that implicitly

  1   2   >