Needed return type in static method? bug or feature?

2016-03-08 Thread Antonio Corbi via Digitalmars-d-learn
Hi all! The following code compiles and works, but the static methods do not have a return type. It also compiles and works if the appropiate (or auto) return type is added to them. -8>< import std.stdio; class B { int foo () { return 1; }

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 14:13:17 UTC, Adam D. Ruppe wrote: On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: Is it a feature or a bug? It is allowed because the "auto" keyword doesn't actually required for auto functions (or variables), what you need is any one of the

Re: Default implementations in inherited interfaces

2016-07-24 Thread Antonio Corbi via Digitalmars-d-learn
On Sunday, 24 July 2016 at 07:54:11 UTC, Jonathan Marler wrote: On Thursday, 21 July 2016 at 13:37:30 UTC, Saurabh Das wrote: On Thursday, 21 July 2016 at 12:42:14 UTC, Adam D. Ruppe wrote: On Thursday, 21 July 2016 at 09:41:27 UTC, Saurabh Das wrote: Java 8 has a 'default' keyword that allows

Caesar Cipher Cracking

2016-08-14 Thread Antonio Corbi via Digitalmars-d-learn
Hi folks, I was just following Graham Hutton's excellent book "Programming in Haskell" (http://www.cs.nott.ac.uk/~pszgmh/book.html) and in chapter 5 He implements a Caesar-Cipher cracking algorithm in a few lines of Haskell code (http://www.cs.nott.ac.uk/~pszgmh/cipher.lhs). So, as I'm

Re: Caesar Cipher Cracking

2016-08-15 Thread Antonio Corbi via Digitalmars-d-learn
On Sunday, 14 August 2016 at 18:36:02 UTC, Stefan wrote: same code, just a little shorter. usage of ".array" more UFCS replaced cast with ".to" Wow Stefan! Thanks for your time, I'll have a look at it! Antonio

Re: Dub recursive build and forcing pre-build commands to run

2016-07-09 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 9 July 2016 at 00:03:22 UTC, Meta wrote: I have two questions. 1. Is it possible to build subpackages when dub build is invoked for the main package? It's a pain to first do dub build :mysubpackage and then dub build. 2. It seems that when dub detects that no dependencies need

Re: Dub recursive build and forcing pre-build commands to run

2016-07-10 Thread Antonio Corbi via Digitalmars-d-learn
On Sunday, 10 July 2016 at 07:00:18 UTC, Meta wrote: On Saturday, 9 July 2016 at 07:52:56 UTC, Antonio Corbi wrote: I use the "preGenerateCommands" and "dependencies" like this: "configurations" : [ { "comment" : "Classic app.", "name"

std.functional.compose compilation error

2016-08-25 Thread Antonio Corbi via Digitalmars-d-learn
Hello, Trying to compile this example from Chuck Allison: --- import std.stdio; import std.functional; void main() { auto div3 = (double x) => x/3.0; auto sq = (double x) => x*x; auto pls1 = (double x) => x+1.0; alias

Re: Learning ddoc

2016-09-29 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 29 September 2016 at 11:50:26 UTC, bachmeier wrote: On Thursday, 29 September 2016 at 09:35:56 UTC, Antonio Corbi wrote: [...] They used https://github.com/economicmodeling/harbored Thanks! that's it. Antonio

Re: Array Copying syntax

2016-09-16 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 16 September 2016 at 18:12:22 UTC, Steven Schveighoffer wrote: On 9/16/16 2:03 PM, Antonio Corbi wrote: Hi Jonathan! Probably this entry in https://dlang.org/spec/arrays.html#usage confused me a bit. int[3] s; s = ...; // error, since s is a compiled in static

Re: How to get a screenshot?

2016-09-22 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 22 September 2016 at 02:21:16 UTC, Konstantin Kutsevalov wrote: On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote: On Wednesday, 21 September 2016 at 16:33:58 UTC, Konstantin Kutsevalov wrote: do anybody know how to get screenshot (for now in Linux only)? May be

Re: How to get a screenshot?

2016-09-22 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 22 September 2016 at 07:50:07 UTC, Antonio Corbi wrote: On Thursday, 22 September 2016 at 02:21:16 UTC, Konstantin Kutsevalov wrote: On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote: [...] Hmm, that's good idea as fast solution. Thank you Adam. Hi

Array Copying syntax

2016-09-16 Thread Antonio Corbi via Digitalmars-d-learn
Hi! I was just playing with array initialization and copying and discovered that this syntax works as expected but it is not referenced under https://dlang.org/spec/arrays.html#array-copying: -8><- int[3] s; int[3] t; s = t; -8><- Is it safe to use or do I have to use the

Re: Array Copying syntax

2016-09-16 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 16 September 2016 at 17:11:54 UTC, Adam D. Ruppe wrote: On Friday, 16 September 2016 at 17:03:20 UTC, Antonio Corbi wrote: Is it safe to use or do I have to use the proposed 's[] = t;' or 's[] = t[]' ? That works for all arrays. `s = t` for dynamically sized arrays (aka slices)

Re: Array Copying syntax

2016-09-16 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 16 September 2016 at 17:55:59 UTC, Jonathan M Davis wrote: On Friday, September 16, 2016 17:22:41 Antonio Corbi via Digitalmars-d-learn wrote: Shouldn't it be mentioned then in the docs that this works for statically sized arrays and that in that case it copies contents? Well, I

Re: std.functional.compose compilation error

2016-08-25 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 25 August 2016 at 14:30:00 UTC, Meta wrote: On Thursday, 25 August 2016 at 14:06:32 UTC, Antonio Corbi wrote: Hello, Trying to compile this example from Chuck Allison: --- import std.stdio; import std.functional; void main() { auto div3

Learning ddoc

2016-09-29 Thread Antonio Corbi via Digitalmars-d-learn
Hi, I'm in the process of learning how ddoc works. I've successfully created docs for my code and recently learned how to generate it using dub. Related to this and after seeing the announcement of the new release of the emsi-containers library, I had a look at its docs

Re: Continued looking at properties in D - interfaces and constraints

2016-10-09 Thread Antonio Corbi via Digitalmars-d-learn
On Sunday, 9 October 2016 at 11:54:50 UTC, mikey wrote: Hi, I'm continuing to look at properties in D and have found another area where I think there may be an issue - or maybe where I'm doing something wrong. I have started trying to use constraints on my properties to constrain which

Re: Switch ignores case (?)

2016-11-24 Thread Antonio Corbi via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 22:13:38 UTC, ketmar wrote: On Wednesday, 23 November 2016 at 22:00:58 UTC, Steven Schveighoffer wrote: I can't see why you need to deal with the glue layer at all -- just tell the glue layer that it's a list of strings and not dstrings ;) 'cause that is how

Re: Continued looking at properties in D - interfaces and constraints

2016-10-12 Thread Antonio Corbi via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 06:20:05 UTC, mikey wrote: On Sunday, 9 October 2016 at 14:06:42 UTC, Antonio Corbi wrote: 1. Inheritance with contracts is evaluated in a special way, 'in contracts' in the base and derived method (property) are or-ed, so if one of them passses, the contract

Re: gtkD load images

2017-08-04 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 3 August 2017 at 21:06:36 UTC, Johnson Jones wrote: On Thursday, 3 August 2017 at 13:12:03 UTC, Mengu wrote: On Thursday, 3 August 2017 at 03:59:40 UTC, Johnson Jones wrote: How can be use gtkD to load images, I assume through gdkpixbuf? While I am getting errors loading images

replacement for squeeze and removechars.

2017-07-18 Thread Antonio Corbi via Digitalmars-d-learn
Hi all, I'm trying dmd-2.075.0-rc1 in one of my projects where I use `squeeze` and `removechars`. Both of them are flagged as obsolete and in the docs we are suggested to use functions from std.regex and/or std.algorithm. Does any one kow a one-liner from std.regex or std.algorithm that

Re: replacement for squeeze and removechars.

2017-07-18 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:55:00 UTC, Seb wrote: On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: As Seb somewhat undiplomatically put, there are replacements listed in the changelog. Sorry - it wasn't intended to be an offense or aggressive. I consider(ed) RTFM as common internet

Re: replacement for squeeze and removechars.

2017-07-18 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 18 July 2017 at 15:41:44 UTC, Meta wrote: On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote: Hi all, I'm trying dmd-2.075.0-rc1 in one of my projects where I use `squeeze` and `removechars`. Both of them are flagged as obsolete and in the docs we are suggested to use

Re: How to replace pairs tags with regexp

2017-07-21 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 21 July 2017 at 07:08:34 UTC, Suliman wrote: On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong with next regex https://dpaste.dzfl.pl/024a47ed2a56 I expect that it will select: #Header my header text ##SubHeader

Re: How to replace pairs tags with regexp

2017-07-21 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 21 July 2017 at 07:42:28 UTC, Suliman wrote: On Friday, 21 July 2017 at 07:30:07 UTC, Antonio Corbi wrote: On Friday, 21 July 2017 at 07:08:34 UTC, Suliman wrote: On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong

Re: std.stdio.stderr

2017-06-10 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 10 June 2017 at 16:10:18 UTC, Russel Winder wrote: It appears that std.stdio.stderr does not wor exactly as stdio stderr does. In particular std.stdio.stderr.writef(…) does not work as fprintf(stderr…) does. Some code I am porting from C++ to D makes use of ANSI escape codes to

Re: core file

2017-11-13 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 13 November 2017 at 09:49:29 UTC, codephantom wrote: On Monday, 13 November 2017 at 06:25:20 UTC, Tony wrote: I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file" was configurable, and it appears that it isn't. ok. that's because Ubuntu is not (by default) setup

Re: GtkD help

2017-11-19 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 18 November 2017 at 22:31:15 UTC, Ivan Trombley wrote: Any information about using gio.Settings would be really appreciated too. Hi Ivan, I would recommend you to search for information about Gtk under valadoc pages [1]. You'll get Vala syntax but doing the mental-mapping to

Re: Working with images

2017-11-01 Thread Antonio Corbi via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 12:02:08 UTC, Alexandre wrote: I have a project written in C++, that I'm thinking to migrating to D, but, what is preventing me from migrating to D, is the part of the system that works with images, where the system generates the image of a payment receipt,

Destructor for struct invoked many times

2019-01-15 Thread Antonio Corbi via Digitalmars-d-learn
Hi, In this simple example, the destructor for the struct is invoked four more times than expected: import std.stdio; struct Person { string name; int age; ~this() { writefln("%s is gone (0x%x)", name, ); } } int main(string[] args) { Person* p = new Person; writefln

Re: Destructor for struct invoked many times

2019-01-15 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 10:49:17 UTC, rikki cattermole wrote: Because you passed it by value to writeln, which goes on to pass it to many other functions. Thanks Rikki! I was thinking about something like that. Antonio

preconditions and interfaces

2019-01-20 Thread Antonio Corbi via Digitalmars-d-learn
Hi all, Playing with interfaces and preconditions in methods I get strange results with dmd-2.0.84.0 but also with dmd-nightly. My code is like this: - import std.stdio; interface Thing2D { void width(int w) in { writeln("Thing2D.width contract w = ",w);

Re: getopt short-options documentation

2018-11-30 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 29 November 2018 at 20:55:22 UTC, Daniel Kozak wrote: Are you sure? Can you show me an example? I always forgot on this limitation and somtimes it cause really nesty things :D On Thu, Nov 29, 2018 at 6:05 PM Antonio Corbi via Digitalmars-d-learn < digitalmars-d-le

getopt short-options documentation

2018-11-29 Thread Antonio Corbi via Digitalmars-d-learn
Hi! Reading through the `getopt` documentation at one point it says: "Forms such as -t 5 and -timeout=5 will be not accepted." But I'm able to to use short options like '-t 5' (with spaces between the 't' and the '5'). It seems that this limitation has been eliminated and it

dub + ddoc

2018-11-21 Thread Antonio Corbi via Digitalmars-d-learn
Hi! I'm trying to build the docs for my project with `dub -b docs` and dub also generates the docs for the dependencies of my project. Is it possible to generate the docs *only* for my code? Thx!

Re: Submenu Not Responding Until Second Click

2019-02-08 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 8 February 2019 at 10:03:03 UTC, Ron Tarrant wrote: On Thursday, 7 February 2019 at 08:41:29 UTC, Antonio Corbi wrote: Hi Ron, xrandr (and gui interfaces for it like arandr) are your friends here. xrandr -q -> shows your card outputs and then you can use xrandr + options to

Re: Linux & DMD & GtkD

2019-02-16 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote: On Saturday, 16 February 2019 at 14:29:56 UTC, Russel Winder wrote: Pass, sorry. Thanks for the replies, guys... I quoted the above line because it's just about the only thing I understood. Let me explain... It's been

Re: Submenu Not Responding Until Second Click

2019-02-07 Thread Antonio Corbi via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 13:13:44 UTC, Ron Tarrant wrote: On Tuesday, 5 February 2019 at 09:41:06 UTC, Antonio Corbi wrote: It could be so, I'm not using gnome so I can't say. By the way, I'm using gtk3 3.24.5. Yeah, I updated from 3.22 to 3.24, but it made no difference on Windows

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 4 February 2019 at 18:34:55 UTC, Ron Tarrant wrote: I posted about this over on the GtkD site, but I suspect no one's home until later in the day. [...] And it still does the same thing. First click, blue line. Second click, menu drops. Hi Ron: It's working OK for me (gtkd

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 09:31:01 UTC, Ron Tarrant wrote: On Tuesday, 5 February 2019 at 08:51:49 UTC, Antonio Corbi wrote: Have you tweaked your gtk theme? If so, could you try with the default (Adwaita) gtk theme? This is a Linux/Gnome thing, I'm assuming? Still, I'll look into

Re: Abstract classes vs interfaces, casting from void*

2019-08-10 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 10 August 2019 at 08:20:46 UTC, John Colvin wrote: On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote: Thanks for the extra detail. Is there a solid reason to ever use an interface over an abstract class? (Other than multiple inheritance). I'm such a noob at

Re: Unexpected aliasing

2019-11-11 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 11 November 2019 at 19:17:37 UTC, Bastiaan Veelo wrote: Recently I got my first surprise with our use of D. The symptom was that two local variables in two different functions appeared to be sharing data. A simplified example is shown below (the original was machine translated

Re: Blog Post #79: Notebook, Part III - Customized Tabs, Part I

2019-10-16 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 15 October 2019 at 22:02:35 UTC, WebFreak001 wrote: On Tuesday, 15 October 2019 at 20:03:00 UTC, Ron Tarrant wrote: ... Do you have links for these? thanks! :p both the packages can simply be found on dub: https://code.dlang.org/search?q=glade Not sure if there are other ways

Re: Blog Post #0099: A Special Request

2020-01-23 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 23 January 2020 at 12:29:11 UTC, Ron Tarrant wrote: On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi wrote: https://gitlab.com/amcorbi/dmaurerrose I think this is somewhat related to what te OP was asking for. I'm confused. I was the OP, so I'm not sure who you're

Re: Blog Post #0099: A Special Request

2020-01-23 Thread Antonio Corbi via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 21:22:57 UTC, Ron Tarrant wrote: On Tuesday, 21 January 2020 at 22:12:10 UTC, Antonio Corbi wrote: On Tuesday, 21 January 2020 at 22:06:30 UTC, Ron Tarrant wrote: Do you still have the Maurer Rose example? I had to look this up. I'd never heard of it

Re: Blog Post #0099: A Special Request

2020-01-21 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 21 January 2020 at 22:06:30 UTC, Ron Tarrant wrote: On Tuesday, 21 January 2020 at 18:57:47 UTC, Jan Hönig wrote: I would also like to request a future blog post about animation. I know you have done that in the past, but i am thinking of some animation triggered by user input

Re: GUI library for DMD 2.090 or DMD 2.091

2020-04-27 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 27 April 2020 at 11:27:57 UTC, Paulo Pinto wrote: On Sunday, 26 April 2020 at 09:09:04 UTC, Antonio Corbi wrote: On Saturday, 25 April 2020 at 09:30:44 UTC, Paulo Pinto wrote: On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote: [...] Just curious, how do you handle the

Re: GUI library for DMD 2.090 or DMD 2.091

2020-04-26 Thread Antonio Corbi via Digitalmars-d-learn
On Saturday, 25 April 2020 at 09:30:44 UTC, Paulo Pinto wrote: On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote: [...] Just curious, how do you handle the whole RC> story in Gtk-rs? For me it made the point that languages with tracing GC or implicit reference counting are