Re: How to get the client's MAC address in Vibe
On Wednesday, 7 February 2024 at 22:16:54 UTC, Alexander Zhirov wrote: Is there a way to identify a client by MAC address when using the Vibe library? The `NetworkAddress` [structure](https://vibed.org/api/vibe.core.net/NetworkAddress) does not provide such features. Or did I miss something? That doesn't have anything to do with the server side if I am not mistaken as you should receive that via the browser that actually allows you to receive the mac address -via an extension- or some private API exposed by the browser. I don't know the use case but you may be better off with browser fingerprinting if you'd like to have a unique way of identifying the visitors. Or, if it's a local network, maybe you can use tcpdump/libpcap.
Re: Effective String to Date conversion?
On Monday, 22 January 2024 at 10:56:04 UTC, atzensepp wrote: Dear D-gurus, being new to D I am trying my first steps and the language is quite intuitive and appealing. When reading a file and creating a hash for the reocrds I want to get only the most recent ones. For this I need to convert Date/Time-Strings to comparable DateTime-Objects. The code below works but looks a bit clumsy. Is there a more efficient (shorter) way to accomplish this? [...] If your date conforms to an ISO or extended ISO format, you can use DateTime.fromISOString [0] or DateTime.fromISOExtString [1] functions. [0] https://dlang.org/phobos/std_datetime_date.html#.Date.fromISOString [1] https://dlang.org/phobos/std_datetime_date.html#.Date.fromISOExtString
Re: Sociomantic Tsunami now under new community maintainership
On Wednesday, 30 September 2020 at 08:31:25 UTC, Iain Buclaw wrote: Hello Everybody, Tsunami is a set of core libraries, applications, and tools that were used at sociomantic labs/dunnhumby Germany, and have been available as open-source software since 2017 under the direction and management of dunnhumby. [...] this is hell of a work. thank you for getting it out and thank you to all the contributors.
Re: Silicon Valley C++ Meetup - August 28, 2019 - "C++ vs D: Let the Battle Commence"
On Saturday, 31 August 2019 at 13:18:46 UTC, Ali Çehreli wrote: On 08/31/2019 05:50 AM, a11e99z wrote: > my English is not very well Apparently mine is not either. My wife was hearing the video from a distance and saying it sounded exactly like Turkish when she could not distinguish the words. The sad part is, I agree. :) > for this video default subtitle language > is Dutch Will fix. Thank you, Ali your wife is right, i also thought you were speaking turkish. :-)
Re: Redis client hunt-redis RC1 released
On Saturday, 27 July 2019 at 17:25:50 UTC, Johannes Loher wrote: Am 27.07.19 um 16:00 schrieb zoujiaqing: [...] However, you do not seem to keep his copy right. In the whole project, there is not a single mention of Jedis or its author "Jonathan Leibiusky". The MIT license, under which Jedis is licensed, explicitly requires you to keep the original copyright notice: [...] OT: chinese -> english translation is really good on google translate.
Re: Autonomous driving company is looking for D software engineers
On Tuesday, 18 June 2019 at 19:05:05 UTC, Dragos Carp wrote: AID GmbH (https://aid-driving.eu) a subsidiary of AUDI AG is looking for experienced D-evelopers in Munich. If you want to employ your D expertise and be part of the autonomous driving revolution, apply under: https://jobs.lever.co/aid-driving/c4b243bd-c106-47ae-9aec-e34d5bbe0ce1?lever-via=vcPRnEaCR3 this really is a very nice opportunity.
Re: How an Engineering Company Chose to Migrate to D
On Wednesday, 20 June 2018 at 13:21:30 UTC, Mike Parker wrote: If you saw Bastiaan Veelo's DConf 2017 presentation, you'll know that his employer was evaluating D as a candidate for migrating their code base away from Extended Pascal. Recently, the decision was made and D was the coice. In this post, Bastiaan tells the story of how that came to be and how they'll be moving forward. The blog: https://dlang.org/blog/2018/06/20/how-an-engineering-company-chose-to-migrate-to-d/ Reddit: https://www.reddit.com/r/programming/comments/8si75b/how_an_engineering_company_chose_to_migrate_to_d/ i hope some of the core people are helping with this transition and making sure this becomes a D success story.
Re: Announcing Mecca
On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote: Hello everybody, I am very happy to announce that Mecca version 0.0.1 (sorry, no more zeros than that) is now officially available. You can get the source code at https://github.com/weka-io/mecca. The API documentation is at https://weka-io.github.com/mecca/docs. [...] why the name mecca?
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Read article here: https://stackshare.io/posts/dev-tools-roundup-april-2018 Why is this relevant? Because it means that D is getting some exposure to industrial development! congratulations!
Re: DConf hotel poor QoS
On Monday, 12 March 2018 at 19:30:06 UTC, Luís Marques wrote: On Friday, 9 March 2018 at 15:26:24 UTC, Luís Marques wrote: Mar-9: I send them an email saying I continue to await a correction to my reservation. Mar-12: I get an email saying that "the event is fully booked for the dates requested" and they suggest an alternative rate of 93€. I follow Mike's lead and book it using Expedia for less than 64€. have they refunded you for the previous booking?
Re: Release D 2.079.0
On Saturday, 3 March 2018 at 01:50:25 UTC, Martin Nowak wrote: Glad to announce D 2.079.0. This release comes with experimental `@nogc` exception throwing (-dip1008), a lazily initialized GC, better support for minimal runtimes, and an experimental Windows toolchain based on the lld linker and MinGW import libraries. See the changelog for more details. Thanks to everyone involved in this https://dlang.org/changelog/2.079.0.html#contributors. http://dlang.org/download.html http://dlang.org/changelog/2.079.0.html - -Martin looks like huge work was done on this release. thank you all.
Re: Quora: Why hasn't D started to replace C++?
On Thursday, 8 February 2018 at 15:29:08 UTC, Ralph Doncaster wrote: On Wednesday, 7 February 2018 at 22:31:58 UTC, John Gabriele wrote: I'm not sure how long dub has been around, but having an easy to use CPAN-alike (online module repo) is HUGE. Dub is great for sales. The better dub and the repo gets, the more attractive D gets. I completely agree that the availability of libraries is a huge factor. I almost gave up on D because of the limited amount of 3rd party libs. I think just improving the search function would help. http://code.dlang.org/search?q=keccak Comes up with nothing, so I started porting a sha3/keccak lib from C to D. Then someone pointed out botan has sha3 support, which can be found if you search for "crypto" http://code.dlang.org/search?q=crypto i think it is the ecosystem. we do not have a better ecosystem to offer and accommodate c++ developers. by ecosystem i mean, things that take the pain out of a c++ developer and make them solely focus on their code. we don't have an IDE, we don't have one perfect, portable GUI library, we don't have a better build system, we don't even have a migration guide for them. (d for c++ developers page does not count) we only have a better and easier language. that's all we have. otherwise i do not think c++ developers are sadomasochists that would do this torture to themselves. :)
Re: Bootstrap D template
On Monday, 29 January 2018 at 11:04:19 UTC, Seb wrote: Have you ever wanted to use D in a project where not everyone had D installed or maybe you wanted to fix the compiler to a specific version? [...] clojure's lein support starter templates. it'd be great if dub did such a thing too. thanks for the effort.
Re: Tuple DIP
On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote: As promised [1], I have started setting up a DIP to improve tuple ergonomics in D: [...] how do we vote for / support this DIP?
Re: Creating Struct for an output of a program.
On Tuesday, 9 January 2018 at 07:57:19 UTC, Vino wrote: Hi All, Request your help on how to create a struct with the output of the below program. Program: import std.algorithm: all, map, filter; import std.stdio: File, writeln; import std.typecons: Tuple, tuple; import std.container.array; import std.string: split, strip; import std.uni: isWhite, toLower; import std.range: chunks; void main () { Array!string TableData, StructureData; auto Meta = File("C:\\Users\\bheev1\\Desktop\\Current\\Script\\Others\\meta\\meta.txt", "r"); auto MetaData = Array!(Tuple!(string, string))(Meta.byLineCopy() .filter!(line => !line.all!isWhite) .map!(a => a.split(":")) .map!(a => tuple(a[0].toLower.strip, a[1].toLower.strip))); foreach (line; MetaData[]) { TableData.insertBack(line[0]); StructureData.insertBack(line[1]); } for(int i = 0; i < TableData[].length; i++ ) { auto S1 = StructureData[i].split(",").chunks(3); auto S2 = S1.map!(a => tuple(a[0],a[1],a[2])); for(int z =0; z < S2.length; z++) { writefln("%-8s %;s", S2[z][1] , S2[z][0]); } } } Output: string name; string country; int age; Need to create as struct using the output struct Layout { { string name; string country; int age; } From, Vino.B if S2 consists of data for Layout struct, then you can simply do: auto S2 = S1.map!(a => Layout(a[0], a[1], a[2])); which will give you a range of Layout.
Re: The D Blog in 2017
On Saturday, 6 January 2018 at 16:08:06 UTC, Mike Parker wrote: My annual retrospective on the D Blog is up. Managing the blog really is a lot of fun for me. Every time I click the publish button I stay glued to reddit and the stats page to see how it's being received, with a glance now and again at the forum announcement to see what sort of mistakes I missed, often well past my bedtime (I love living in Korea, but the time zone can be rather inconvenient!). Here, I list the new blog features I enjoyed working on in 2017 and, my favorite part, some stats. I wrap up with a bit about what to expect in 2018. Blog: https://dlang.org/blog/2018/01/06/the-d-blog-in-2017/ Reddit: https://www.reddit.com/r/d_language/comments/7ok098/the_d_blog_in_2017/ thanks for the great job mike. we appreciate it. i'm enjoying the GC series myself.
Re: C++ Interop
On Friday, 5 January 2018 at 13:02:12 UTC, qznc wrote: I'm exploring [0] C++ interop after watching Walter's presentation [1]. I hit a block with classes as template parameters. This means vector works, but vector does not. D seems to map vector!Foo to vector. Likewise shared_ptr is a problem. Any way to fix that on the D side? The ugly workaround is to adapt the C++ code. I understand that this mapping makes sense for function calls because bar(Foo f) in D maps to bar(Foo *f) in C++. And C++ bar(Foo f) has no equivalent in D because classes are reference types. On a related note, C++ interop requires to redeclare or even reimplement C++ code. Has anybody started a libcpp-in-d project? I'm looking for basics like vector and string. [0] https://github.com/qznc/d-cpptest [1] https://youtu.be/IkwaV6k6BmM is C++ support in LDC better than what we have with DMD? i did checkout your code btw and could not enjoy it more. :)
Re: How do you use D?
On Wednesday, 3 January 2018 at 16:20:48 UTC, Joakim wrote: On Wednesday, 3 January 2018 at 11:43:35 UTC, Paulo Pinto wrote: On Wednesday, 3 January 2018 at 11:13:04 UTC, Joakim wrote: On Wednesday, 3 January 2018 at 10:29:05 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 3 January 2018 at 09:56:48 UTC, Pjotr Prins wrote: [...] I perceived that there was a lot of hype around Python 15 years ago or so. Now, universities are replacing Java with Python as the introduction language and Python is also becoming the defacto language for scientific programming. Python is basically getting critical mass and is now managing to take on Matlab and perhaps to some extent even C++/Fortran. Python has done well in those niches, but when is the last time you saw a popular GUI app written in Python? That is the largest segment of the market, and Python has basically no uptake there. Even Java got nowhere in the consumer GUI market, other than a few p2p apps like Vuze and the now-defunct Limewire, largely for piracy. you could not be more wrong. there are tons of python gui applications. pygtk, pyqt and wxpython are great libraries that allows you to create desktop apps very easy and fast. D does not even have a good solution except for gtkD which is a one man show. if it wasn't for Mike we would not even have it. leadership does not care. remember qtd guys stopping everything because a bug was not getting fixed? there's also one other thing: atom, vs code, spotify, slack are all running on electron. does it make it a better platform than python?
Re: What don't you switch to GitHub issues
On Sunday, 31 December 2017 at 19:49:07 UTC, Meta wrote: On Sunday, 31 December 2017 at 11:18:26 UTC, Seb wrote: On Saturday, 30 December 2017 at 02:50:48 UTC, Adam D. Ruppe wrote: Bugzilla was the most well-known solution at the time. Keep in mind the D bugzilla has been around since 2006. As far as I understand it, migration at this point is deemed a big pain. No it wouldn't be a big pain. There are many tools for automatically migrating issues from Bugzilla. The only thing depending on Bugzilla is the changelog generator, but it's API calls to Bugzilla can be replaced with GitHub API calls within an hour. So the entire migration could be easily done in a lot less than a day. The only reason we still use Bugzilla is that the core people are used to it. Here are a couple of the common arguments: 1) Bugzilla is our, we don't want to depend on GitHub The D ecosystem already heavily depends on GitHub. Exporting the issues from GitHub would be easy. Besides there is only one person with access to the Bugzilla server. 2) GitHub only has per registry issues Bugzilla uses components too, they don't support global issues either. Besides if that's required one could easily create a meta repository for such global tasks. 3) Bugzilla's issue tracker is more sophisticated Sure, but does this help when you loose out on many contributors? GitHub even has build tools and sites that let anyone discover "easy" issues if they are labeled accordingly. It's free marketing. FYI I asked the same question 1 1/2 years ago: https://forum.dlang.org/post/ezldcjzpmsnxvvncn...@forum.dlang.org Since then, for example, GitHub got voting for issues, but Bugzilla lost it. I wholeheartedly agree. The customer is always right, especially when you're trying to get them to donate their time to an open source project. It's more essential than ever that we lower barriers to participation; if Github issues is the hip new thing all the kids like, then we need to switch to that. We shouldn't be constantly switching to the shiniest new toy, but nor should we stubbornly stick to a piece of software that was built (and it looks it) in '90s. Or at least we should if we're trying to attract the kind of people for whom not using Github is a deal breaker. Older C++/Java programmers likely don't care, but younger Python/Ruby/JS users will. there are three things that i've noticed: - in this thread, there is not a single positive post by walter. none. nada. zilch. it'd have been much better if he just did not post anything. - d leadership is dusty and so are their tools. we are no js community and hope we never become anything like them but bugzilla is a hundred years old. i am on github, i am on this ml and i also need a bugzilla account? what else do i need to be a part of this community? why can't you provide me a seamless travel in between? have a forum software, allow me to sign in via github and i am a member of the community. but no, they love their ugly bugzilla, they love their mailing list. - has anyone realized we do not attract anyone who has just started to learn programming? what are we going to do about it?
Re: How do you safely deal with range.front?
On Saturday, 30 December 2017 at 19:00:07 UTC, aliak wrote: On Friday, 29 December 2017 at 20:47:44 UTC, Dukc wrote: [...] Hmm, interesting. Not sure that's what I'm looking for but I like it anyway :) I'm more looking to deal with situations like this: Instead of this: auto result = range.op!f; if (!result.empty) { result.front.method(); } This: range.op!f.ifFront.method(); In the above scenario I only want method to be called if the pipeline resulted in any element left in the range. [...] True you don't want to call front on empty, but sometimes I only care to call a method on front if it's there. Where the situation necessitates the existence of front, and not having a front is indeed a bug, then you want the program to terminate, yes. But not otherwise. it would be actually great in such scenarios if d had a language construct for existantial checks. you'd just be able to do range.front?.method(). but no, it is not 2017. d does not need it.
Re: structs inheriting from and implementing interfaces
On Friday, 29 December 2017 at 13:08:38 UTC, rikki cattermole wrote: On 29/12/2017 12:59 PM, rjframe wrote: On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote: [...] I've actually thought about doing this to get rid of a bunch of if qualifiers in my function declarations. `static interface {}` compiles but doesn't [currently] seem to mean anything to the compiler, but could be a hint to the programmer that nothing will directly implement it; it's a compile-time interface. This would provide a more generic way of doing stuff like `isInputRange`, etc. Or we could get signatures, which are even better still! + for SML style signatures!
Re: Maybe D is right about GC after all !
On Friday, 29 December 2017 at 00:26:04 UTC, codephantom wrote: On Thursday, 28 December 2017 at 08:53:25 UTC, Russel Winder wrote: [...] I disagree. [...] syntax is not weird at all. it is ML-ish.
Re: How do I set a class member value by its name in a string?
On Wednesday, 27 December 2017 at 23:47:14 UTC, Biotronic wrote: [...] much, much better. thanks biotronic.
Re: How do I set a class member value by its name in a string?
On Wednesday, 27 December 2017 at 21:39:49 UTC, Mengu wrote: On Wednesday, 27 December 2017 at 20:54:17 UTC, bitwise wrote: [...] there's also a simple workaround for fields with the same type: https://run.dlang.io/is/dsFajq import std.stdio; struct S { int x; int y; } auto setValue(ref S s, string field, int value) { foreach (fieldName; __traits(allMembers, S)) { if (fieldName == field) { __traits(getMember, s, fieldName) = value; break; } } } void main() { S s; s.setValue("x", 5); s.setValue("y", 25); writeln(s); } you can play with it to make it more generic. you can also create a mixin template that would generate setters for each field you would need a setter for and then in the run time you'd just be able to call them. return type should just be void. that's just my muscle memory. :-D
Re: How do I set a class member value by its name in a string?
On Wednesday, 27 December 2017 at 20:54:17 UTC, bitwise wrote: On Wednesday, 27 December 2017 at 20:04:29 UTC, Marc wrote: I'd like to set the members of a class by its name at runtime, I would do something like this: __traits(getMember, myClass, name) = value; but since name is only know at runtime, I can't use __traits(). What's a workaround for this? I think you could write something using a combination of these two things: https://dlang.org/phobos/std_traits.html#FieldNameTuple https://dlang.org/phobos/std_traits.html#Fields or maybe '.tupleof': https://dlang.org/spec/struct.html#struct_properties there's also a simple workaround for fields with the same type: https://run.dlang.io/is/dsFajq import std.stdio; struct S { int x; int y; } auto setValue(ref S s, string field, int value) { foreach (fieldName; __traits(allMembers, S)) { if (fieldName == field) { __traits(getMember, s, fieldName) = value; break; } } } void main() { S s; s.setValue("x", 5); s.setValue("y", 25); writeln(s); } you can play with it to make it more generic. you can also create a mixin template that would generate setters for each field you would need a setter for and then in the run time you'd just be able to call them.
Re: D as a betterC a game changer ?
On Wednesday, 27 December 2017 at 14:06:51 UTC, Dan Partelly wrote: On Wednesday, 27 December 2017 at 09:39:22 UTC, codephantom wrote: [...] Well, C++ had to evolve over a very long period of time, and maintain compatibility with C. No other programming language had to deal with technical and social issues C++ had to deal with. By comparison, D is young, and had the advantage it had no constrains to be compatible (language wise) with another language. Evolution time is not an excuse to a mixed personality (even if perceived). For all it's evolution time and mistakes and idiotic size of the language to pay for C's sins and omissions I do not see C++ as mixed personality. I never did. It evolved consistently. Also, another language, Ada went through 1 standard and 3 major revisions in almost 35 years and retained it's personality basically unchanged. Too bad it was designed with a Wirthian syntax, which IMO was one of the factors it doomed it. D went GC, but no quite mandatory GC, also not quite able to run its in entirety without GC, then in it's old age, went for cosmetic surgery to look like slim and sexy miss C. Much like a beautiful and capricious women with commitment issues and a fear of aging which went through 5 husbands. And it all started with a GC and several wrong defaults [...] God knows. All "x" users of D would scream bloody murder, imo. if that would become the d way and made us write memory safe code, why not? rust developers already have to write code under compiler dictated terms and nobody's complaining. d developers who write d code like java are small in numbers compared to those who don't. heck, i'll go even further and wish pure was also default.
Re: Article: Finding memory bugs in D code with AddressSanitizer
On Tuesday, 26 December 2017 at 08:03:44 UTC, Temtaime wrote: The main font is very ugly. Code font looks ok tw. on the contrary, post font is very readable (might use some letter spacing), clear and beautiful. that is on a retina macbook pro. code blocks are very readable too.
Re: partial application for templates
On Monday, 25 December 2017 at 22:58:50 UTC, David Nadlinger wrote: On Monday, 25 December 2017 at 20:39:52 UTC, Mengu wrote: is partially applying templates possible? Check out std.meta.Apply{Left, Right}. — David thanks a lot mr. smith & david.
Re: Can I use memoize with a non-static struct method?
On Tuesday, 26 December 2017 at 00:47:14 UTC, Marc wrote: something like this: struct S { // variables... string doGen(int n) { return ""; } alias gen = memoize!doGen; } The error I got is: Error: need 'this' for 'doGen' of type 'string(int n)' I can't make doGen static because it access non-static struct members... can I workaround this? i don't want to mislead you and i don't know if this is somehow possible but what about some ufcs magic? string doGen(S s, int n) { return "hello ".repeat().take(n).join(); } struct S { int x; auto gen() @property { return memoize!doGen(this, x); } } void main() { S s = S(5); s.gen.writeln; s.x = 10; s.gen.writeln; s.x = 15; s.gen.writeln; s.x = 20; s.gen.writeln; }
partial application for templates
is partially applying templates possible?
Re: Define enum value at compile time via compiler argument?
On Monday, 25 December 2017 at 16:13:48 UTC, Thomas Mader wrote: Hello, I would like to set the path to a directory at compile time but it doesn't seem to be possible yet. I tried it with a -version=CustomPath argument and inside the version statement in the code I tried to read the value from the environment. Sadly this doesn't work because getenv can not be interpreted at compile time because it has no available source. Now my question is if this is somehow possible and I just don't see it or would it be possible to add that somehow? Thanks in advance. Thomas is it a relative path? if so: pragma(msg, __FILE_FULL_PATH__.split("/")[0..$-1].join("/")); https://run.dlang.io/is/gRUAD6
Re: Does to!(string)(char[]) do any memory allocation on conversion?
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote: Does to!(string)(char[]) do any memory allocation on conversion or is this similar to a cast or what else? yes, it is allocating memory. you can test such cases with @nogc [0]. you can get a char[] via .dup of a string and then you can cast(string) if you don't want to allocate any memory. [0] https://dlang.org/spec/attribute.html#nogc
Re: Converting array in to aliased tuple type.
On Monday, 25 December 2017 at 12:03:32 UTC, aliak wrote: Hi, been looking for a way to convert an array to a tuple, but can't seem to find one. Is there one? Looking for something like: alias Point = Tuple!(int, "x", int, "y"); enum data = "1,2:8,9"; auto points = data .split(':') .map!(a => a .split(',') .map!(to!int) ) .map!Point; // <-- this works if you do `.map!(a => Point(a[0], a[1]));` instead Cheers! hi aliak since Point is a Tuple and does not have a constructor that takes a list of integers (int[]), you should have a helper function. import std.stdio: writeln; import std.string: split; import std.algorithm: map; import std.typecons: Tuple; import std.conv: to; alias Point = Tuple!(int, "x", int, "y"); enum data = "1,2:8,9"; alias makePoint = (auto ref points) => Point(points[0], points[1]); alias convertToInt = (string parts) => parts.split(',').map!(to!int); auto points = data.split(':').map!(convertToInt).map!(makePoint); writeln(points);
Re: excel-d v0.2.16 - now with more @Async
On Saturday, 23 December 2017 at 22:19:50 UTC, Laeeth Isharc wrote: On Friday, 22 December 2017 at 22:08:23 UTC, Mengu wrote: On Friday, 22 December 2017 at 00:41:31 UTC, Atila Neves wrote: excel-d lets you write plain D code that can be run from Excel unmodified via the magic of compile-time reflection. [...] can we use excel-d with office for mac? I don't think so but I am not familiar with the Excel API on Mac so it's possible not too many changes required. Pull requests welcomed :) surely i'll give it a try.
Re: One liner for creating an array filled by a factory method
On Saturday, 23 December 2017 at 08:57:18 UTC, kerdemdemir wrote: On Friday, 22 December 2017 at 23:33:55 UTC, Mengu wrote: On Thursday, 21 December 2017 at 21:11:58 UTC, Steven Schveighoffer wrote: On 12/21/17 4:00 PM, kerdemdemir wrote: I have a case like : http://rextester.com/NFS28102 I have a factory method, I am creating some instances given some enums. My question is about : void PushIntoVector( BaseEnum[] baseEnumList ) { Base[] baseList; foreach ( tempEnum; baseEnumList ) { baseList ~= Factory(tempEnum); } } I don't want to use "foreach" loop. Is there any cool std function that I can call ? Something like baseEnumList.CoolStdFunc!( a=> Factory(a) )(baseList); https://dlang.org/phobos/std_algorithm_iteration.html#map -Steve so basically it becomes: Base[] baseList = baseEnumList.map!(el => Factory(el)); there's also a parallel version of map [0] if you ever need to map the list concurrently. [0] https://dlang.org/phobos/std_parallelism.html#.TaskPool.map Yeah that was very easy and I used to use map for this purposed a lot already. I don't know why I get confused. Thanks guys for correction. I began to think like map could transform but it can't create vector of elements and this confused me. it totally depends on the type of resulting element. if you expect Base[], then your map should transform your range / array elements into a Base. import std.range, std.algorithm; auto a = iota(1, 10); int[] b = a.map!(el => el + 1).array; int[][] c = a.map!(el => [el, el + 1]).array; writeln(b); writeln(c);
Re: One liner for creating an array filled by a factory method
On Thursday, 21 December 2017 at 21:11:58 UTC, Steven Schveighoffer wrote: On 12/21/17 4:00 PM, kerdemdemir wrote: I have a case like : http://rextester.com/NFS28102 I have a factory method, I am creating some instances given some enums. My question is about : void PushIntoVector( BaseEnum[] baseEnumList ) { Base[] baseList; foreach ( tempEnum; baseEnumList ) { baseList ~= Factory(tempEnum); } } I don't want to use "foreach" loop. Is there any cool std function that I can call ? Something like baseEnumList.CoolStdFunc!( a=> Factory(a) )(baseList); https://dlang.org/phobos/std_algorithm_iteration.html#map -Steve so basically it becomes: Base[] baseList = baseEnumList.map!(el => Factory(el)); there's also a parallel version of map [0] if you ever need to map the list concurrently. [0] https://dlang.org/phobos/std_parallelism.html#.TaskPool.map
Re: Don't expect class destructors to be called at all by the GC
On Thursday, 21 December 2017 at 18:45:27 UTC, Adam D. Ruppe wrote: On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote: When the scoped destruction of structs isn't an option, RefCounted!T seems to be a less evil alternative than an unreliable class dtor. :-/ Alas, RefCounted doesn't work well with inheritance... Though, what you could do is make the refcounted owners and borrow the actual reference later. i really wonder how Objective-C and Swift is pulling this off.
Re: Converting member variables to strings with using reflection from base class
On Friday, 22 December 2017 at 22:09:05 UTC, H. S. Teoh wrote: On Fri, Dec 22, 2017 at 09:13:31PM +, kerdemdemir via Digitalmars-d-learn wrote: I want to make a logging function for member variables by using reflection. [...] class B { void Log() { auto a = [__traits(derivedMembers, D)]; foreach(memberName; a) { // Somehow write only member variables with their names // Result should be : a = 4.0, b = 3.0 Try this: import std.traits : FieldNameTuple; foreach (memberName; FieldNameTuple!B) { writefln("%s = %s", memberName, mixin("this." ~ memberName)); } T and then turn it into a LoggerMixin with a mixin template and re-use it any time you want. import std.stdio : writeln, writefln; import std.traits : FieldNameTuple; mixin template LoggerMixin() { void Log() { foreach (memberName; FieldNameTuple!(typeof(this))) { writefln("%s = %s", memberName, mixin("this." ~ memberName)); } } } struct S { int x; bool y; double z; mixin LoggerMixin; } void main() { S s1 = S(int.min, true, ); S s2 = S(int.max, false, ); s1.Log(); s2.Log(); }
Re: alias to struct method
On Friday, 22 December 2017 at 17:53:34 UTC, Marc wrote: How can I create a alias to a struct method? struct S { string doSomething(int n) { return ""; } } I'd like to do something like this (imaginary code): alias doSomething = S.doSomething; then call it by doSomething(3) I got the following error from this code: Error: need 'this' for 'gen' of type 'string(int n)' So I tried create a instance: alias doSomething = S().doSomething; Changes the error to: app.d(96): Error: function declaration without return type. (Note that > constructors are always named this) app.d(96): Error: semicolon expected to close alias declaration it is also possible with getMember trait but why don't you just mark that method as static?
Re: excel-d v0.2.16 - now with more @Async
On Friday, 22 December 2017 at 00:41:31 UTC, Atila Neves wrote: excel-d lets you write plain D code that can be run from Excel unmodified via the magic of compile-time reflection. [...] can we use excel-d with office for mac?
Re: why @property cannot be pass as ref ?
On Wednesday, 20 December 2017 at 18:04:57 UTC, Ali Çehreli wrote: On 12/20/2017 07:02 AM, ChangLong wrote: > [...] is not > [...] The problem is not with opAssign but with left(), which returns an rvalue. It's by design that rvalues cannot be bound to references in D. [...] was just reading this: https://p0nce.github.io/d-idioms/#Rvalue-references:-Understanding-auto-ref-and-then-not-using-it
Re: Can I run this at compile time?
On Wednesday, 20 December 2017 at 16:54:35 UTC, Marc wrote: Give this function I'd like to run it at compile time: import std.concurrency : Generator, yield; [...] but when I do: [...] I get the following erros: C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\thread.d(4059): Error: static variable PAGESIZE cannot be read at compile time C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(1548): called from here: super.this(dg, PAGESIZE * 4u, PAGESIZE) app.d(96):called from here: getNonIntegralMembers() if PAGESIZE is not dynamic, it will not work at compile time. make it an enum or const and give it a try.
Re: Maybe D is right about GC after all !
On Tuesday, 19 December 2017 at 10:09:41 UTC, Walter Bright wrote: On 12/19/2017 2:02 AM, rikki cattermole wrote: On 19/12/2017 9:54 AM, Walter Bright wrote: "C, Python, Go, and the Generalized Greenspun Law" http://esr.ibiblio.org/?p=7804 I must agree, GC is a wonderful fallback. I tend to write hybrid programs in D, so I wouldn't call it a fallback. Just like I might use both structs and classes! hi walter i never had a chance to thank you for d, so here it goes: thank you very much! been in love with it for so long. despite my anger, i keep coming back :) would you mind writing a tutorial / blog post on this matter for dummies such as myself? from what i gather from the forum posts is that _in theory_ we can do this but _in reality_ most of us don't know how.
Re: weird exception on windows
On Saturday, 16 December 2017 at 14:05:28 UTC, Vino wrote: On Saturday, 16 December 2017 at 13:59:11 UTC, Vino wrote: On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote: [...] H, All, Are are also getting the same exception on Windows after updating the dmd to version v2.077.1, our code was working fine for the past 2 months, the exception is just crashes the program, and it occur's every 1 time among in 3 runs. As per Microsoft it stated to download the package apps.diagcab and execute, but still no luck. ExceptionCode: C005 From, Vino.B Moreover we were able to find the line of code which was causing this exception string a = "1" a.to!int.isNumber /* exception is occurring at this point. From, Vino.B the compiler might be parsing the expr like (a.to!(int.isNumber)) so it becomes a.to!bool.
Re: A list of all the awesome people who made D possible
On Monday, 18 December 2017 at 15:58:59 UTC, Seb wrote: D wouldn't be this powerful, rocking language as it is today without all its contributors who worked very hard on improving. To start showing our gratitude and as a token of appreciation, we have started listing all the awesome people who made D possible on dlang.org: [...] does writing a book count? if so, the list is missing ali :-)
Re: Deploying D web servers
On Sunday, 17 December 2017 at 21:07:45 UTC, bauss wrote: On Sunday, 17 December 2017 at 17:06:32 UTC, cloutiy wrote: Hi, In the Javascript world there are services that provide a quick and simple means of deploying websites. I've used things like surge.sh, netlify. I'm sure there are many others. Is there something similar that exists for the D world? Regards Map a drive to your server and have DUB build to it. what does this mean?
Re: GUI program on Mac OS in D?
On Thursday, 14 December 2017 at 14:07:25 UTC, Adam D. Ruppe wrote: I was playing with this myself based on Jacob's code and made it look like this: extern (Objective-C) interface ViewController : NSViewController { extern (C) @ObjCMethodOverride("loadView") static void loadView(ViewController self, SEL sel) { printf("loadView\n"); } extern (C) @ObjCMethodOverride("viewDidLoad") static void viewDidLoad(ViewController self, SEL sel) { printf("viewDidLoad\n"); } ViewController init() @selector("init"); mixin RegisterObjCClass; } so the mixin does some registering based on the method override attrs. It is still static with self cuz I actually felt hiding that made things a bit worse (inheritance wouldn't work like you expect), but most the registration stuff is now pulled from the attribute metadata. Of course, my goal here isn't actually to do all of obj-c... just enough to port my simpledisplay.d. So I'm not sure if I'll make this public yet or just leave it as private and/or undocumented inside my library file. please make it public.
Re: run.dlang.io - a modern way to run D code
On Thursday, 14 December 2017 at 06:43:58 UTC, Mike Franklin wrote: On Thursday, 14 December 2017 at 06:26:16 UTC, Seb wrote: It's interesting to see that no one complained about gdc not being there - I thought that this would be the first comment. Allow me to be the first. But seriously, considering the use case for run.dlang.io, I don't see the need for hosting any compilers other than dmd-latest and dmd-nightly. Everything else is just gravy. Mike rust playground has plenty of choices in that matter but there's something better. it supports the top 100 most used dependencies so they are just an import away. @seb, you think this could be added?
Re: Druntime and non-D threads
On Monday, 11 December 2017 at 16:25:42 UTC, Ali Çehreli wrote: On 12/08/2017 02:54 AM, Nemanja Boric wrote: [...] So, in cases where D is just a portable library, the only sane thing to do seems to be what Kagamin suggested: create a D thread and send requests to it. That way, we would be in total control of our threads, making entry-attach/exit-detach calls unnecessary. Agreed? Ali care to explain what exactly that means for the rest of us who are n00bs? :-)
Re: GSoC 2018 - Your project ideas
On Sunday, 10 December 2017 at 19:04:54 UTC, Seb wrote: On Sunday, 10 December 2017 at 13:01:43 UTC, Mengu wrote: On Tuesday, 5 December 2017 at 18:20:40 UTC, Seb wrote: [...] do i have to be an actual student in order to participate? I redirect your question to Google's official FAQ: https://developers.google.com/open-source/gsoc/faq#what_are_the_eligibility_requirements_for_participation I hope this answers your question. indeed it did, thanks.
Re: Invoking writeln() from a lot of threads running concurrently --> crash
On Saturday, 9 December 2017 at 10:36:08 UTC, Messenger wrote: On Saturday, 9 December 2017 at 09:38:05 UTC, IM wrote: For purposes of debugging, I'm using writeln() to print stuff out from tasks running concurrently on many threads. At some point it crashes with the following stack trace: Thread 4 received signal SIGUSR1, User defined signal 1. [...] Bug in phobos? Is that a crash or just thread 4 receiving SIGUSR1? (GC signal) If so you just need to tell gdb not to stop on that. ("handle SIGUR1 SIGUSR2 nostop", place it in ~/.gdbinit) i've been bitten many times by this. thanks to the folks on irc, it now lives in gdbinit.
Re: D User Survey
On Friday, 8 December 2017 at 22:22:14 UTC, Nick Sabalausky (Abscissa) wrote: On 12/08/2017 05:53 AM, Chris wrote: [...] Speaking as a US citizen, it's long been my observation that americans (and I only mean collectively, of course, it's difficult to generalize down to individuals since that varies greatly) tend to be far more conservative than one would assume them to be. [...] this is exactly my observation on HN.
Re: GSoC 2018 - Your project ideas
On Tuesday, 5 December 2017 at 18:20:40 UTC, Seb wrote: Hi all, Google Summer of Code (GSoC) 2018 is about to start soon [1] (the application period for organizations is in January 2018). Hence, I would very happy about any project ideas you have or projects which are important to you. And, of course, if you would be willing to mentor a student, please don't forget to tell me. You can always reach me via mail (seb [at] wilzba [dot] ch) or on Slack (dlang.slack.com). There's also a special #gsoc channel. [...] do i have to be an actual student in order to participate?
Re: Post about comparing C, C++ and D performance with a real world project
On Friday, 8 December 2017 at 15:40:08 UTC, Steven Schveighoffer wrote: On 12/7/17 8:11 PM, Mengu wrote: On Thursday, 7 December 2017 at 22:39:44 UTC, Daniel Kozak wrote: The other slowdown is caused by concatenation. Because std::string += is more simillar to std.array.(Ref)Appender wait, i thought appenders performed better than concatenation. is that not true or did i just misunderstand your post? You misunderstood. Appender is faster than ~= to a straight array, because it doesn't have to do any opaque lookups in the GC to see if it needs to reallocate -- all the information is right there. Daniel's point was that Appender is more akin to std::string (which doesn't have the benefit of having language-defined array operaions). If the blogger used Appender, he would have had better performance. -Steve thanks for the explanation steve.
Re: Post about comparing C, C++ and D performance with a real world project
On Thursday, 7 December 2017 at 22:39:44 UTC, Daniel Kozak wrote: The other slowdown is caused by concatenation. Because std::string += is more simillar to std.array.(Ref)Appender wait, i thought appenders performed better than concatenation. is that not true or did i just misunderstand your post?
Re: Sort characters in string
On Wednesday, 6 December 2017 at 12:43:09 UTC, Fredrik Boulund wrote: On Wednesday, 6 December 2017 at 10:42:31 UTC, Dgame wrote: Or you simply do writeln("longword".array.sort); This is so strange. I was dead sure I tried that but it failed for some reason. But after trying it just now it also seems to work just fine. Thanks! :) if you're like me, you probably forgot an import :)
Re: lower case only first letter of word
On Tuesday, 5 December 2017 at 14:34:57 UTC, Mengu wrote: On Tuesday, 5 December 2017 at 14:01:35 UTC, Marc wrote: On Tuesday, 5 December 2017 at 13:40:08 UTC, Daniel Kozak wrote: [...] Yes, this is not what I want. I want to convert only the first letter of the word to lower case and left all the others immutable. similar to PHP's lcfirst(): http://php.net/manual/en/function.lcfirst.php this is how i'd do it: string upcaseFirst(string wut) { import std.ascii : toUpper; import std.array : appender; auto s = appender!string; s ~= wut[0].toUpper; s ~= wut[1..$]; return s.data; } however a solution that does not allocate any memory would be a lot better.
Re: lower case only first letter of word
On Tuesday, 5 December 2017 at 14:01:35 UTC, Marc wrote: On Tuesday, 5 December 2017 at 13:40:08 UTC, Daniel Kozak wrote: but this will change all other uppercase to lowercase, so maybe it is not what you want. If you really want just change first char to upper, then there is nothing wrong to do it yourself On Tue, Dec 5, 2017 at 2:37 PM, Daniel Kozakwrote: Something like this: https://dlang.org/phobos/std_uni.html#asCapitalized On Tue, Dec 5, 2017 at 2:31 PM, Marc via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: Does D have a native function to capitalize only the first letter of the word? (I'm asking that so I might avoid reinvent the wheel, which I did sometimes in D) Yes, this is not what I want. I want to convert only the first letter of the word to lower case and left all the others immutable. similar to PHP's lcfirst(): http://php.net/manual/en/function.lcfirst.php this is how i'd do it: string upcaseFirst(string wut) { import std.ascii : toUpper; import std.array : appender; auto s = appender!string; s ~= wut[0].toUpper; s ~= wut[1..$]; return s.data; }
Re: git workflow for D
On Sunday, 3 December 2017 at 20:05:47 UTC, bitwise wrote: I've finally started learning git, due to our team expanding beyond one person - awesome, right? Anyways, I've got things more or less figured out, which is nice, because being clueless about git is a big blocker for me trying to do any real work on dmd/phobos/druntime. As far as working on a single master branch works, I can commit, rebase, merge, squash, push, reset, etc, like the best of em. What I'm confused about is how all this stuff will interact when working on a forked repo and trying to maintain pull requests while everyone else's commits flood in. How does one keep their fork up to date? For example, if I fork dmd, and wait a month, do I just fetch using dmd's master as a remote, and then rebase? Will that actually work, or is that impossible across separate forks/branches? What if I have committed and pushed to my remote fork and still want to merge in the latest changes from dlang's master branch? you can fork it, set dmd/master as upstream and then git fetch upstream. you can then rebase. And how does a pull request actually work? Is it a request to merge my entire branch, or just some specific files? and do I need a separate branch for each pull request, or is the pull request itself somehow isolated from my changes? commits can be cherrypick-ed or you can request your entire branch to be merged. it doesn't always have to be the master branch. for example, if there's std.experimental.logger branch, you can ask for your branch to be merged with that. having a seperate branch for each feature is most of the time the way to go. makes it cleaner for yourself. later on you can delete those merged branches. Anyways, I'd just be rambling if I kept asking questions. If anyone can offer any kind of advice, or an article that explains these things concisely and effectively, that would be helpful. Thanks
Re: D User Survey
On Friday, 1 December 2017 at 18:56:50 UTC, WebFreak001 wrote: Hi everyone, I made a public survey (everyone can look at the responses) and it would be great if you took some time and answered it. I think it will greatly benefit D as a whole if we had more anonymous data on users. I'm also open for changing some questions if there is confusion. https://docs.google.com/forms/d/e/1FAIpQLSdPFx9ebHJ05QSW1VypBsQPw-1RbZ1v8FMgo1su6NvN6VErBw/viewform great idea, just finished the survey.
Re: tour.dlang.org is less than useless
On Tuesday, 28 November 2017 at 02:08:24 UTC, codephantom wrote: Why do we have this link? https://tour.dlang.org I cannot recall it ever working. (is it just something at my end?) What is it meant to take us to? it is most definitely not. it just sometimes fails to load. i have no idea why.
Re: remake of remake of Konami's Knightmare
On Tuesday, 28 November 2017 at 07:47:14 UTC, Nick Sabalausky (Abscissa) wrote: On 11/24/2017 08:28 PM, ketmar wrote: quickfix. forgot to properly set requested OpenGL version. http://files.catbox.moe/lx02hz.7z Very cool! Works under wine for me. Not a game I was familiar with, so it's cool learning hands-on about more of Konami's back catalog from one of the best gaming eras. chrome starts the download and then prevents it. would it be because if 7z?
Re: Intellij D Language v1.15.2
On Thursday, 23 November 2017 at 20:11:01 UTC, singingbush wrote: Hi all. A new release intellij-dlanguage plugin has been made available for download from the Jetbrains repository this week. The speed at which features and bug fixes are being done has picked up recently. We've had 4 releases this month alone. It would be really helpful if there are any Intellij users out there who don't already use our plugin to install it via the plugin repo and try it out (there are 2 D plugins, make sure to install the correct one). We now have error reporting built in to the plugin so that if anything breaks it's easy to inform the team about the problem. There is also support for debugging with GDB (since v1.14 1st Nov). We need to completely overhaul our documentation as some of it is outdated now and there is no mention of the gdb support. If anyone with Java/Kotlin experience wants to get involved with helping squash bugs then we welcome pull requests so please feel free to browse the issues on our github repository and get involved. https://github.com/intellij-dlanguage/intellij-dlanguage If you find the plugin helpful please also rate the plugin: https://plugins.jetbrains.com/plugin/8115-d-language hi singingbush i normally use emacs but i wanted to contribute to the community effort and see how the plugin is. i downloaded IDEA CE 2017.2 and i have imported an existing D project. when i want to run the project it lets me choose if i want to use DUB or DMD (that's great) and then i choose DUB and then it warns me about project not having SDK settings. i then went on and set the DMD/bin path as the SDK folder. i also set the DUB path initially but after running, it told me to configure it again. maybe it did not save in the first place. all in all, it was a pleasure. thank you for your efforts :)
Re: A note on troll engagement
On Monday, 27 November 2017 at 17:44:54 UTC, Andrei Alexandrescu wrote: All: we have had an increase in troll posts lately. Please avoid engaging them and resist the urge to correct assertions no matter how wrong, indignating, etc. The best response to troll posts is spending the time that would elsewhere go in flamewars, on good work. Feel free to use your newsreader's "killfile" feature to filter away posts from aliases you assess have a net negative contribution to this forum. Thanks, Andrei we should switch to a forum software. enough is enough. we can't edit posts, we can't get rid of spammers and trolls. we don't have proper code formatting / syntax highlighting. what is holding you guys back?
Re: Project Highlight: Diamond MVC Framework
On Tuesday, 21 November 2017 at 05:27:50 UTC, bauss wrote: On Monday, 20 November 2017 at 14:39:43 UTC, Mike Parker wrote: You may have seen announcements regarding Diamond here in the forums. The project maintainer, Jason Jensen, a.k.a bauss, provided me with some info about it for a Project Highlight on the D Blog. Blog: https://dlang.org/blog/2017/11/20/project-highlight-diamond-mvc-framework/ reddit: https://www.reddit.com/r/programming/comments/7e98zk/diamond_a_vibedbased_mvc_web_framework_for_d/ Thank you for writing the article! thank you for developing and maintaining such a huge project.
Re: [OT] Windows dying
On Monday, 30 October 2017 at 13:32:23 UTC, Joakim wrote: I don't know how intense your data analysis is, but I replaced a Win7 ultrabook that had a dual-core i5 and 4 GBs of RAM with an Android tablet that has a quad-core ARMv7 and 3 GBs of RAM as my daily driver a couple years ago, without skipping a beat. I built large mixed C++/D codebases on my ultrabook, now I do that on my Android/ARM tablet, which has a slightly weaker chip than my smartphone. how do you program on your tablet? what are your tools? what is your setup? i also believe laptops are here to go.
Re: Beta 2.077.0
On Saturday, 21 October 2017 at 10:10:42 UTC, Martin Nowak wrote: On 10/16/2017 06:45 PM, Martin Nowak wrote: First beta for the 2.077.0 release. Second beta live now. This adds a missing core.sys.linux.netinet.in_ header which is used by vibe.d. Happy Testing - -Martin this was the first problem i faced when i used latest vibe.d and phobos two months ago.
Re: Note from a donor
On Saturday, 28 October 2017 at 02:50:39 UTC, codephantom wrote: On Saturday, 28 October 2017 at 01:08:57 UTC, Mengu wrote: looks like d has a long way to go on freebsd as well. I've had no issues with D in FreeBSD at all... ...and it's been a really smooth transition to D...so far... I have D, Postgresql, and static C/C++ bindings working just fine...and that's really all I need..for now. btw. The FreeBSD platform isn't even mentioned here: https://insights.stackoverflow.com/survey/2017#technology-platforms So I'm just glad it works at all..otherwise I'd have to choose between not using D, or using another platform...and neither choice is appealing. my code that worked amazing on linux and mac os x failed miserably on freebsd which is my server os whenever and wherever possible. i did not have the luxury of days to fix stuff so i simply switched to debian.
Re: Note from a donor
On Saturday, 28 October 2017 at 14:43:38 UTC, codephantom wrote: On Saturday, 28 October 2017 at 14:00:14 UTC, Jerry wrote: On Saturday, 28 October 2017 at 07:39:21 UTC, codephantom wrote: btw. (and I do realise we've gone way of the topic of this original thread)...but... if it interests anyone, this is the outcome of yesterday, where I wasted my whole day trying to get DMD to compile a 64bit .exe on a fresh install of Windows 7. Your own incompetence isn't reason enough for everyone else to suffer. I've never had a problem installing Visual Studio, or getting D to work with it. Nice one Jerry. You're so eager to have a go at me, that you completely missed the point. I explicitly mentioned that I did ***NOT*** want VS installed. All I wanted, was to build a 64bit D binary, and wanted to know what was the minimum components I had to install in order to be able to do that. I had just wanted VS. I would have just installed that. The majority of time spent was downloading the damn thing! Go trawl somewhere else! but what if that is how you can build 64 bit binary? with mac os x, we have to download gbs of command line tools library before getting started with any development. if we want to build anything for ios or mac we have to download 5gb xcode. with a fast internet, you get that in a matter of minutes. i don't believe that should be a show stopper or maybe i am missing your point.
Re: Note from a donor
On Friday, 27 October 2017 at 11:25:13 UTC, codephantom wrote: On Friday, 27 October 2017 at 05:20:05 UTC, codephantom wrote: That's it! I've had enough! 4 hours wasted! ok... I must have done something wrong.. But still, I started testing this whole process at 12:04pm today. It's now 10:23PM All I can say, it thank god I used FreeBSD ;-) pkg install ldc (a few seconds later, I can start compiling 64bit D code). looks like d has a long way to go on freebsd as well.
Re: D for microservices
On Sunday, 22 October 2017 at 02:48:57 UTC, Joakim wrote: I just read the following two week-old comment on the ldc issue tracker, when someone tried to run D on Alpine linux: [...] rock solid, easy, common-dev-proof, huge std lib. like that of golang.
Re: 350$ Job
On Sunday, 22 October 2017 at 17:43:04 UTC, Suliman wrote: Man, you are give to low money for too big job. It's not 350$ for a projects it's much more. You codebase is very dirty and out of date. It's better to you find money to rewrite all from scratch. love that how in each post the money increases. i'll wait till his 500th post. :-)
Re: Silicon Valley D Meetup - October 26, 2017 - "D Fibers" by Ali Çehreli
On Saturday, 21 October 2017 at 18:20:13 UTC, Ali Çehreli wrote: [We're at a very convenient location again this time: Downtown Mountain View.] [...] allahiniz varsa kaydedersiniz. :)
Re: sample collaborative notepad implementation
On Thursday, 12 October 2017 at 01:43:00 UTC, ketmar wrote: in the wootedit repo[0] you can find a very simple (but working) collaborative notepad implementation, based on WOOT algorithm[1][2]. if you ever wanted to know how all those collaborative editors were done... look no further! ;-) wootedit is simple, but complete implementation of such editor, with UDP-based network communication. currently, it was tested under GNU/Linux only, but there are no platform-specific code (except some socket API), so porting it to another OS should be trivial. you will need IV[3] and ARSD[4] libraries to build wootedit. [0] http://repo.or.cz/wootedit.git [1] http://hal.inria.fr/inria-00071240/ [2] https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type [3] http://repo.or.cz/iv.d.git [4] https://github.com/adamdruppe/arsd dude, didn't know you were sitting on a gold mine (iv). thanks for sharing!
Re: D on quora ...
On Friday, 6 October 2017 at 17:14:51 UTC, Rion wrote: https://www.quora.com/What-is-your-review-of-D-programming-language It seems that D still has the GC being mentioned up to today. Maybe its better to move the standard library slower to a non gc version in the future... as a d user, i do not give a single flying fuck about manual memory management. i love gc. period. please let gc be my guest and clean up everything for me. i have other problems like d / dmd / phobos failing me on freebsd; vibe.d working amazing on linux and throwing some random shit on freebsd. d is better than java, let alone c++. they both are crap. garbage. incredibly explicit and verbose. yet they get work done for other people. and these people, since the inception of d are throwing random arguments against d. they never ran out of arguments. it was two std libs, it was two d versions, it was lack of 3rd party libs, it was lack of giant corp support, it was lack of community / resources, it was and it will be something for those people. until they decide to shut the fuck up and actually give d a try. just like great people we get here everyday. a big problem of d is that it is a play-dough for many people here. they don't run into problems with d because they are mostly not eating their own dog food or incredible experts at d. (remember qtd guys?) if we have 100 wtf moments per hour, they probably have like 1-2 per year. they do more abstract stuff rather than concrete stuff. (atila & co, manu, sociomantic people, jacob and some more are exceptions). they are blind to newcomer problems. they also have prejudices like assuming you know all the low level stuff beforehand. when your beloved language (or its toolchain) screws things up for the app you wrote and deployed and will be used by millions of people per year, you have more problems than you imagined earlier and gc is not one of them.
Re: Silicon Valley D Meetup - September 28, 2017 - "Open Methods: From C++ to D" by Jean-Louis Leroy
On Sunday, 1 October 2017 at 02:35:54 UTC, Jonathan M Davis wrote: On Saturday, September 30, 2017 15:30:48 Ali Çehreli via Digitalmars-d- announce wrote: [...] Honestly, it seems a weird that this sort of thing is so hard to get to work, but for some reason, it seems to be the sort of thing that all sorts of folks can't get to work right - including plenty of conferences. I guess that there are just too many things that can go wrong. :| - Jonathan M Davis *puts his biz guy hat on and starts working on something*
Re: Silicon Valley D Meetup - September 28, 2017 - "Open Methods: From C++ to D" by Jean-Louis Leroy
On Friday, 29 September 2017 at 21:06:56 UTC, Ali Çehreli wrote: The slides: https://jll63.github.io/openmethods.d/dlang-meetup-2017-09-28/ Unfortunately, there is no video. it's been years yahu, insan bi kamera ayarlar :) Ali On 09/18/2017 10:38 PM, Ali Çehreli wrote: We're excited to be in San Francisco this month: https://www.meetup.com/D-Lang-Silicon-Valley/events/243022411/ Our host is AdRoll[1]. Ali [1] AdRoll uses D for data science: http://tech.adroll.com/blog/data/2014/11/17/d-is-for-data-science.html
Re: Is it possible to specify the address returned by the address of operator?
On Friday, 29 September 2017 at 02:34:08 UTC, DreadKyller wrote: On Thursday, 28 September 2017 at 14:01:33 UTC, user1234 wrote: [...] I understand that, but because the operator isn't defined normally for classes unless overloaded, then your statement about this being an inconsistency on the concerns stated prior about wrecking implementation of standard features. If & can't be overloaded then the type of will always be a pointer, you can't override the dereference operator of the pointer itself as far as I can tell, overloading it on the class doesn't overload the pointer, thus any standard implementation that uses pointers to store an object would be completely unaffected by overloading the dereference operator. This I don't consider it an inconsistency. [...] +1 for forum issue.
Re: What does ! mean?
On Wednesday, 27 September 2017 at 17:58:27 UTC, Ali Çehreli wrote: On 09/27/2017 08:33 AM, Ky-Anh Huynh wrote: > [...] Wissner wrote: > [...] The fact that such an important operator is explained so late in the book is due to the book's strong desire to have a linear flow. [...] ustad, guess you can still write the new ed. :-)
Re: segfault on gc.impl.conservative.gc.Gcx.smallAlloc
On Tuesday, 26 September 2017 at 17:06:28 UTC, drug wrote: 26.09.2017 00:34, Mengu пишет: [...] not big deal probably, but isn't ~32GB enormous value here? I would check why bigDataFun return this. i could not find out why. d certainly needs to improve on freebsd. i don't think devs would take d seriously if it won't work on a major platform. for now, i switched to debian rather than rewriting the app. i had some invalid memory operation errors but i managed to get rid of them. i'll certainly port the app to another language and switch back to freebsd.
Re: segfault on gc.impl.conservative.gc.Gcx.smallAlloc
On Monday, 25 September 2017 at 21:34:40 UTC, Mengu wrote: hi all this following code block [0] is exiting with "terminated by signal SIGBUS (Misaligned address error)" error. it processes like 200K rows and then fails. any ideas? [...] hi all does anyone else have any ideas?
Re: segfault on gc.impl.conservative.gc.Gcx.smallAlloc
On Tuesday, 26 September 2017 at 00:36:36 UTC, Vladimir Panteleev wrote: On Monday, 25 September 2017 at 21:34:40 UTC, Mengu wrote: delete fileContents; This looks suspicious - it is a slice of the memory-mapped file, not memory on the GC-managed heap, so "delete" is inapplicable to it. The GC ought to throw an exception when attempting to delete things not on the GC heap though. I think the stack trace itself looks like something that should only happen when the GC's internal data structures are corrupted, so you may want to investigate in that direction. thanks vladimir, i'll look into that. i also should mention that everything works as expected on mac os x.
segfault on gc.impl.conservative.gc.Gcx.smallAlloc
hi all this following code block [0] is exiting with "terminated by signal SIGBUS (Misaligned address error)" error. it processes like 200K rows and then fails. any ideas? void getHotels() { import std.parallelism : taskPool; import std.functional : partial; auto sunHotels = new SunHotels(); auto destinations = sunHotels.parseDestinations(); auto conn = client.lockConnection(); auto destinationResult = conn.execStatement("SELECT provider_ref, id FROM hotels_destination", ValueFormat.BINARY); int[int] destinationIds; foreach (row; rangify(destinationResult)) { destinationIds[row["provider_ref"].as!PGinteger] = row["id"].as!PGinteger; } foreach (destination; parallel(destinations)) { const string destId = to!string(destination.destinationId); const auto destinationFilePath = getcwd() ~ "/ext/data/hotels/" ~ destId ~ ".xml"; auto xmlFile = new MmFile(destinationFilePath); auto fileContents = cast(string)xmlFile[0..xmlFile.length]; auto hotels = sunHotels.parseHotelsResult(fileContents); const destIdInDb = destinationIds[destination.destinationId]; auto sqls = appender!string; writeln("parsing destination: ", destination.destinationName); foreach (hotel; parallel(hotels)) { sqls.put(hotel.generateSql(destIdInDb).data.join); } sqls.data.writeln; delete fileContents; delete xmlFile; } } this is the full trace i got [1]: #0 0x00bef5ef in gc.impl.conservative.gc.Gcx.smallAlloc(ubyte, ref ulong, uint) () [Current thread is 1 (LWP 100171)] (gdb) bt full #0 0x00bef5ef in gc.impl.conservative.gc.Gcx.smallAlloc(ubyte, ref ulong, uint) () No symbol table info available. #1 0x00bf3925 in gc.impl.conservative.gc.ConservativeGC.runLocked!(gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), gc.impl.conservative.gc.mallocTime, gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) () No symbol table info available. #2 0x00bed103 in gc.impl.conservative.gc.ConservativeGC.qalloc(ulong, uint, const(TypeInfo)) () No symbol table info available. #3 0x00b9c6e3 in gc_qalloc () No symbol table info available. #4 0x00b96140 in core.memory.GC.qalloc(ulong, uint, const(TypeInfo)) () No symbol table info available. #5 0x0093fdce in std.array.Appender!(immutable(char)[]).Appender.ensureAddable(ulong) (this=..., nelems=761) at /home/search-master/dmd2/freebsd/bin64/../../src/phobos/std/array.d:2929 len = 394 reqlen = 1155 newlen = 1155 u = 0 overflow = false nbytes = 1155 bi = {base = 0x2b1, size = 140737488337376, attr = 4294949280} #6 0x00942c0f in std.array.Appender!(immutable(char)[]).Appender.put!(immutable(char)[]).put(immutable(char)[]).bigDataFun(ulong) ( this=0x7fffb9f0, extra=761) at /home/search-master/dmd2/freebsd/bin64/../../src/phobos/std/array.d:3023 No locals. #7 0x00942b55 in std.array.Appender!(immutable(char)[]).Appender.put!(immutable(char)[]).put(immutable(char)[]) (this=..., ---Type to continue, or q to quit--- at /home/search-master/dmd2/freebsd/bin64/../../src/phobos/std/array.d:3026 bigData = "'" len = 760 newlen = 34799909888 #8 0x0093e80a in hotel.Hotel.generateSql(int) (this=..., destinationId=5743) at source/hotel.d:216 sqls = {_data = 0x81d5ca6c0} sql = {_data = 0x81d5ca6e0} childSqls = {_data = 0x81d5ca700} #9 0x009194c9 in app.getHotels().__foreachbody1(ref destination.Destination).__foreachbody2(ref hotel.Hotel) (this=0x7fffd2a0, __applyArg0=...) at source/app.d:211 hotel = {provider_ref = 121475, destinationId = 7931, resortId = 11313, transfer = 0, roomTypes = {{rooms = {{roomType = 0x81a351188, hotelId = 121475, roomId = 5369802, beds = 2, extrabeds = 0, meals = 0x0}}, roomType = "Twin/Double room", roomTypeId = 21}, {rooms = {{roomType = 0x81a35c108, hotelId = 121475, roomId = 5761375, beds = 2, extrabeds = 0, meals = 0x0}}, roomType = "Double room Queen bed", roomTypeId = 2651}}, reviews = 0x0, distance = nan(0xc), type = "Hotel", name = "Best Western Carriage House Inn and Suites", addr_1 = "1936 Highway 45 Bypass", addr_2 = 0x0, zip_code = "38305", city = "Jackson", state = "TN", country = "United States", country_code = "US", address = "1936 Highway 45 Bypass 38305 Jackson TN United States", mapurl = "http://www.sunhotels.net/GoogleMaps/showGoogleMap.asp?hotelId=121475=en;, headline = "With a stay at Best Western Carriage House Inn & Suites in Jackson, you'll be minutes from Casey Jones Village and close to Old Hickory Mall",
how to build project with locally compiled phobos
hi all i've successfully compiled phobos master with gmake on freebsd. (make fails, i've no clue at all as to why) how do i compile my project now against my local phobos with dub? with plain dmd? i tried (in dub.sdl): - full path to new libphobos.so with -defaultlib to dflags - full path to new libphobos.so to lflags i checked with ldd and saw the original libphobos.so was used. my current workaround is copying mine to /usr/lib. thanks in advanced.
Re: [FreeBSD] 0x000000000061d8cd in rt.aaA.Impl.findSlotLookup(ulong, const(void*), const(TypeInfo)) inout ()
On Saturday, 23 September 2017 at 11:23:26 UTC, Nicholas Wilson wrote: On Saturday, 23 September 2017 at 08:45:00 UTC, Mengu wrote: [...] So it fails: trying to find if an element exists in an AA in a regex invoked as a callback from curl inside a parallel foreach. Interesting that it just straight up core dumps, usually you'll get an exception. see https://forum.dlang.org/thread/rrpmgzqqtkqgeicjd...@forum.dlang.org for a recent discussion. What it the stack limit? 35 frames is a fair bit, could be a stack overflow. What is the return code? this will probably give you some info as to what happened. Only other thing I can suggest is try linking against a debug phobos to see if you can get some more diagnostics. hi nicholas the latter is what i did. i re-compiled phobos master and used it. this time everything worked as expected. btw, regex match happens in HTTP.Impl.onReceiveHeader. i think it no longer had access to that header to parse.
[FreeBSD] 0x000000000061d8cd in rt.aaA.Impl.findSlotLookup(ulong, const(void*), const(TypeInfo)) inout ()
hello everyone i have a small program that parses an xml file, holding a list with 13610 elements. after making the list, it iterates over the list (paralele), goes to a web site and grabs the related data for that element. it works perfect for the first 1K element in the list. after that i get a very annoying segmentation fault. no exceptions, nothing. it just dumps a core file. below is the full stack trace. (also available at https://pastebin.com/PT1R5D7S) i appreciate any help. my dmd info: DMD64 D Compiler v2.076.0-dirty Copyright (c) 1999-2017 by Digital Mars written by Walter Bright my os info: FreeBSD metropol.com 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 r...@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 (gdb) bt full #0 0x0061d8cd in rt.aaA.Impl.findSlotLookup(ulong, const(void*), const(TypeInfo)) inout () No symbol table info available. #1 0x005dcb21 in _aaInX () No symbol table info available. #2 0x0067fef0 in std.regex.internal.ir.getMatcher(std.uni.InversionList!(std.uni.GcPolicy).InversionList) () No symbol table info available. #3 0x00677a26 in std.regex.internal.parser.CodeGen.charsetToIr(std.uni.InversionList!(std.uni.GcPolicy).InversionList) () No symbol table info available. #4 0x00655f47 in std.regex.internal.parser.Parser!(immutable(char)[], std.regex.internal.parser.CodeGen).Parser.parseEscape() () No symbol table info available. #5 0x00654680 in std.regex.internal.parser.Parser!(immutable(char)[], std.regex.internal.parser.CodeGen).Parser.parseAtom() () No symbol table info available. #6 0x006541e3 in std.regex.internal.parser.Parser!(immutable(char)[], std.regex.internal.parser.CodeGen).Parser.parseRegex() () No symbol table info available. #7 0x006570f0 in std.regex.internal.parser.Parser!(immutable(char)[], std.regex.internal.parser.CodeGen).Parser.this!(const(char)[]).this(immutable(char)[], const(char)[]) () No symbol table info available. #8 0x00652fb1 in std.regex.regexImpl!(immutable(char)[]).regexImpl(immutable(char)[], const(char)[]) () No symbol table info available. #9 0x00636af3 in std.functional.memoize!(std.regex.regexImpl!(immutable(char)[]).regexImpl(immutable(char)[], const(char)[]), 8).memoize(immutable(char)[], const(char)[]) () No symbol table info available. #10 0x005fd617 in std.regex.regex!(immutable(char)[]).regex(immutable(char)[][], const(char)[]) () No symbol table info available. #11 0x005fd472 in std.regex.regex!(immutable(char)[]).regex(immutable(char)[], const(char)[]) () No symbol table info available. #12 0x005f7bb7 in std.net.curl.HTTP.Impl.onReceiveHeader(void(const(char[]), const(char[])) delegate).__lambda2(const(char[])) () No symbol table info available. #13 0x005fb98a in std.net.curl.Curl.onReceiveHeader(void(const(char[])) delegate).__lambda2(const(char[])) () No symbol table info available. #14 0x005fbdce in std.net.curl.Curl._receiveHeaderCallback(const(char*), ulong, ulong, void*) () No symbol table info available. #15 0x00080681838b in ?? () from /usr/local/lib/libcurl.so No symbol table info available. #16 0x000806816c95 in ?? () from /usr/local/lib/libcurl.so No symbol table info available. #17 0x00080683119c in ?? () from /usr/local/lib/libcurl.so No symbol table info available. #18 0x00080683bd94 in ?? () from /usr/local/lib/libcurl.so No symbol table info available. ---Type to continue, or q to quit--- #19 0x00080683b56b in curl_multi_perform () from /usr/local/lib/libcurl.so No symbol table info available. #20 0x0008068334b0 in curl_easy_perform () from /usr/local/lib/libcurl.so No symbol table info available. #21 0x005fb77c in std.net.curl.Curl.perform(std.typecons.Flag!("throwOnError").Flag) () No symbol table info available. #22 0x005f8a20 in std.net.curl.HTTP.perform(std.typecons.Flag!("throwOnError").Flag) () No symbol table info available. #23 0x005cff60 in provider.SunHotels.getHotels(destination.Destination) (this=0x80097e000, destination=...) at source/provider.d:226 __closptr = 0x800980800 filePath = "/usr/home/search-master/search-api/ext/data/hotels/6593.xml" __dollar = 7 hotelsPath = "http://some-domain.com; data = {ptr = 0x80097f240} http = {p = {_refCounted = {_store = 0x805a14000}}} postData = "some=postData" __flag = 2 __EAX = 0x8002901170 __exception_object = 0x0 __EAX = 0x8002901170 __EDX = -851895465 __handler = 0 __exception_object = 0x801f12540 #24 0x0059cdb2 in app.getDestinations().__foreachbody1(ref destination.Destination) (this=0x7fffe850, __applyArg0=...) at source/app.d:164 destination = {destinationId = 6593, destinationCode = "GRR", destinationCode_1 = 0x0,
Re: D Tour is down
On Monday, 28 August 2017 at 17:16:59 UTC, Mengu wrote: On Monday, 28 August 2017 at 08:19:10 UTC, Petar Kirov [ZombineDev] wrote: On Monday, 28 August 2017 at 07:52:00 UTC, Joakim wrote: On Monday, 28 August 2017 at 07:44:48 UTC, Wulfklaue wrote: On Sunday, 27 August 2017 at 22:27:45 UTC, Mengu wrote: d tour page is down for at least a week now. someone please fix that. thanks. Seems to be active for me ... It shows a blank page for me. Also, the wiki seems really slow nowadays. Can you try again? I think that if there was a problem, it is gone now. it works on my android phone rn. i'll post if it doesn't work on the mac. on mac, with chrome version 60.0.3112.90 (64-bit), it renders an empty page.
Re: D Tour is down
On Monday, 28 August 2017 at 08:19:10 UTC, Petar Kirov [ZombineDev] wrote: On Monday, 28 August 2017 at 07:52:00 UTC, Joakim wrote: On Monday, 28 August 2017 at 07:44:48 UTC, Wulfklaue wrote: On Sunday, 27 August 2017 at 22:27:45 UTC, Mengu wrote: d tour page is down for at least a week now. someone please fix that. thanks. Seems to be active for me ... It shows a blank page for me. Also, the wiki seems really slow nowadays. Can you try again? I think that if there was a problem, it is gone now. it works on my android phone rn. i'll post if it doesn't work on the mac.
D Tour is down
d tour page is down for at least a week now. someone please fix that. thanks.
Re: D as a Better C
On Friday, 25 August 2017 at 00:24:14 UTC, Michael V. Franklin wrote: On Thursday, 24 August 2017 at 19:21:31 UTC, Walter Bright wrote: [...] Great! I look forward to seeing improvements and hope to help. [...] i believe that should be an opt-out. what about newcomers? will they have to learn how to link std lib?
Re: How to specify a template that uses unqualified type, like any normal function
On Monday, 14 August 2017 at 13:48:36 UTC, Dominikus Dittes Scherkl wrote: if I use fixed-type functions, I can do the following: uint foo(uint n) { ++n; // modify n - as this function has received a copy of n, this is always possible return 42; } uint bar(const uint n) { assert(foo(n)==42); return 17; } void main() { bar(3); } But if I try the same with a template parameter, it doesn't work: import std.traits; // Unqual uint foo(T)(Unqual!T n) // first try { ++n; // modify should be possible return 42; } uint foo2(T)(T n) // second try { ++n; // modify fails, as T is const return 42; } uint bar(T)(const T n) { assert(foo(n)==42u); // cannot deduce arguments - why?!? assert(foo2(n)==42u); // here it can deduce the arguments, but the function cannot modify n return 17; } void main() { bar(3); } Any ideas what I need to do to make this work? hi dominikus you can call functions as func(arg) when compiler can infer the types for your functions but when it's not you'll get an "cannot deduce arguments" error. when you call bar template function, you won't be able to modify the argument n. ++n will not work and will throw an error at compile time. import std.traits : Unqual; import std.stdio : writeln; uint normalFoo(int n) { ++n; return n; } uint constNormalFoo(const int n) { ++n; // will raise error return n; } uint templateFoo(T)(Unqual!T n) { ++n; return n; } uint constTemplateFoo(T)(const Unqual!T n) { ++n; // will raise error return n; } void main() { writeln(normalFoo(42)); // writeln(constNormalFoo(42)); writeln(templateFoo!int(42)); // writeln(constTemplateFoo!int(42)); } more info is available at:
Re: Need some vibe.d hosting advice
On Friday, 11 August 2017 at 13:06:54 UTC, aberba wrote: So I'm into this platform with a vibe.d api server + back-end and I'm confused/curious to know the hosting package to use. I will have a lot of images uploaded by users. 1. For sometime, I've been looking at heroku which is fine with its load balancer, easily scaling etc. But the hosting cost for a startup is high and (most importantly) requires an external storage either s3 or cloudinary which no lib in D currently exist for them (stable). 2. Get an EC2 instance from Amazon or Vultr and install everything yourself and save images on disc (potentially problematic). This can not be scaled easily 3. use a self-hosted PaaS like Flynn (aka self hosted heroku) ...but you still have to store images in an object storage and a D api is needed for this. Which links back to point 1 but less costly and more control. How would you do it if you were using vibe.d? (With node.js, all these are solved). heroku is a bit more expensive. for starters, you could have a vps on digitalocean and let your application run on there. google cloud is an excellent platform that i run my company on. it is a lot cheaper than aws.
Re: Calling C++ "void foo(Klass&)"
On Thursday, 10 August 2017 at 07:58:55 UTC, Arjan wrote: On Thursday, 10 August 2017 at 00:32:40 UTC, Mengu wrote: my second question is: i have no idea what's going on in this file: https://github.com/whoshuu/cpr/blob/master/include/cpr/body.h i'd appreciate some pointers. A new 'type' named Body which IS-A std::string is defined. i think we can mimic this with an alias this for a string (or const char*) property. is that right? To construct a Body there are various options: The ctors 'default': Body(), 'copy': Body(const Body&) and 'move': Body(Body&&) ctors are using the compiler generated default implementation. The same is true for the assignment operators = how can i check what compiler generates for default so i can add them to my extern C++ clause? Then a few explicit conversion ctors are defined to construct a Body from a const char* string and std::string. Explicit means the compiler is not allowed to implicit convert to std::string or const char* for provide args not being a const char* or std::string but for which a conversion exists. i'll give these converters a try. Since the h file also contains the definitions, the compiler must inline the code for the Body ctors and assignment operator. It also means not C/cpp file is needed since the function bodies are already in the h file. i realized that when i saw the member initialization syntax in header files. HTH thank you very much for the detailed explanation.
Re: Calling C++ "void foo(Klass&)"
On Tuesday, 8 August 2017 at 21:04:23 UTC, Jacob Carlborg wrote: On 2017-08-08 20:51, Johan Engelen wrote: Hi all, Currently, it is not possible to call the C++ function "void foo(Klass&)" when Klass is an extern(C++) _class_ on the D side. You have to declare Klass as a D _struct_, otherwise there is no way to get the correct mangling. When Klass has virtual functions, you're hosed. For more context (involving "const"), see: https://forum.dlang.org/post/tvohflgtaxlynpzed...@forum.dlang.org Is this problem on anybody's radar? What are the ideas to resolve this issue, or are we content never to solve it? One way to do it, that might be a bit confusing, is to force the declaration of the function to explicitly specify a pointer or a reference. Currently it looks like it's an implicit pointer. extern (C++) class Klass {} void foo(Klass*); // ok void foo(ref Klass); // ok void foo(Klass); // error Of course, there's always pragma(mangle) as well. sorry for hijacking the thread but i have a similar question: i was wondering if i could write a wrapper for a C++11 library called cpr. in one of its header files (https://github.com/whoshuu/cpr/blob/master/include/cpr/auth.h#L13) it has a generic constructor that initializes its member fields. i had no idea as to how to do it. then i came up with the following line: extern (C++, cpr) { this(UT, PT)(ref UT username, ref PT password) { ... } } when i compiled it with the .a lib given, it worked. do you guys think i did it right? the & my second question is: i have no idea what's going on in this file: https://github.com/whoshuu/cpr/blob/master/include/cpr/body.h i'd appreciate some pointers.
Re: gtkD load images
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 through glade's image: (test.exe:8188): Gtk-[1;33mWARNING[0m **: Could not load image 'a.jpg': Couldn't recognize the image file format for file 'test\a.jpg' (loads fine in glade) which needs to be resolved, I'd also like to be able to use gdkpixbuf to load images programmatically. There seems to be no demos on the gtkD github page that deals with image loading. I've tried to do something like import gtkc.gdkpixbuf; auto x = c_gdk_pixbuf_get_formats().data; but I don't know how to interpret x. Also something like import gtkc.gdkpixbuf; void* x; auto p = c_gdk_pixbuf_get_formats(); for(int i = 0; i < 10; i++) { x = p.data; p = p.next; } which doesn't offer any help. Aside: How can we call the gtk functions directly using gtkD? Seems it uses stuff like Linker.link(gdk_pixbuf_get_formats, "gdk_pixbuf_get_formats", LIBRARY_GDKPIXBUF); It does seem to alias to these function but something is off and I'm not sure what. hi - is the gtk.Image class not working for you? https://api.gtkd.org/gtkd/gtk/Image.html - there's also a gdkpixbuf.Pixbuf that you can use. https://api.gtkd.org/gtkd/gdkpixbuf/Pixbuf.html - you can import those functions from gdkpixbuf.c.functions.
Re: dlang-requetst: openssl 1.1 compatible release
On Thursday, 3 August 2017 at 10:02:24 UTC, Temtaime wrote: On Thursday, 3 August 2017 at 09:57:11 UTC, Suliman wrote: On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote: Hello, Since version 0.5.0 dlang-requests has become compatible with both 1.0.x and 1.1.x versions of openssl library. Please try and report any issues on github. Thanks! dlang-requests is HTTP/FTP client library, inspired by python-requests with goals: small memory footprint performance simple, high level API native D implementation https://code.dlang.org/packages/requests https://github.com/ikod/dlang-requests Vote for including it in Phobos instead curl! Curl is well-tested and has a great number of features. indeed it is but it needs to be buried deep in phobos and make something with a much much better API available.
Re: Abusive posts
On Monday, 19 June 2017 at 01:06:41 UTC, Meta wrote: On Sunday, 18 June 2017 at 19:57:26 UTC, Walter Bright wrote: There have been a handful of abusive posts here lately. These are not welcome. If you see one, please forward it to me or otherwise let me know, and let me deal with it. Do not reply to them. And specially, DO NOT QUOTE THEM in your reply. That just propagates the problem. The same goes for spam that appears here now and then. Just a quick note that I don't think messages can be forwarded via the web interface. it is time that this forum catches the century and move to an actual forum software where moderation can actually happen.
Re: dmd download spike
On Saturday, 7 January 2017 at 13:52:12 UTC, Benjiro wrote: On Saturday, 7 January 2017 at 13:22:02 UTC, rikki cattermole wrote: Btw, I based this mostly off the number of newbies coming on to IRC. There has been quite a large number :) At least compared to the rest of the yar. Interesting. Maybe it can be useful to get a poll asking the new people how they got introduced to D. Especially if this correlates top the release. If the release news draws in people, maybe it can be interesting to do more increment releases ;) Btw. IRC ... that is so 1999 :) 1999 times better than slack.
Re: Crazy, sad but ... would you use D for your own facebook or pinterest?
On Monday, 2 January 2017 at 21:49:03 UTC, aberba wrote: I'm not building Facebook/pinterest but I'm trying to work on a platform like "pinterest-like" but on a small scale. I want it to be easy to write, fast, ... you know. D is obviously that (IMO). About scalability, would you recommend D(vibe.d initially) for long run (techically, generally, currently)? Why? (Brutal honesty). i'd suggest the language that you know the best, the language that will not block your way and build barriers so you can focus on building your product. maybe later you can port it to D or build some new services in D.
Re: asd
On Monday, 25 July 2016 at 09:10:05 UTC, ahahah wrote: haro herro