Re: User defined type and foreach

2024-01-25 Thread Jim Balter via Digitalmars-d-learn
On Friday, 19 January 2024 at 18:13:55 UTC, Jonathan M Davis wrote: On Friday, January 19, 2024 3:49:29 AM MST Jim Balter via Digitalmars-d-learn wrote: On Friday, 17 November 2017 at 17:55:30 UTC, Jonathan M Davis wrote: > When you have > > foreach(e; range) > > it gets lower

Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-21 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:47:24 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and

Re: User defined type and foreach

2024-01-19 Thread Jim Balter via Digitalmars-d-learn
On Friday, 17 November 2017 at 17:55:30 UTC, Jonathan M Davis wrote: When you have foreach(e; range) it gets lowered to something like for(auto r = range; !r.empty; r.popFront()) { auto e = r.front; } So, the range is copied when you use it in a foreach. Indeed, and the language spec

Re: What's the proper way to add a local file dependence to dub?

2024-01-06 Thread Jim Balter via Digitalmars-d-learn
On Monday, 12 March 2018 at 10:20:20 UTC, Seb wrote: On Sunday, 4 March 2018 at 16:46:56 UTC, Marc wrote: then copy it to sources folder? let's say I have a small library folder at C:\mylibrary\D where I want to use dir.d from it. How do I add that file dependence to dub? But I do not want

Re: Destructors can't be @nogc?

2021-07-24 Thread Jim via Digitalmars-d-learn
On Saturday, 24 July 2021 at 10:15:50 UTC, Mike Parker wrote: Personally, I think `@nogc` on main is a bad idea. `@nogc` should be used as far down the call stack as you can put it. The higher it is, the more difficulty you're going to run into. I recommend you apply it only on functions that

Re: Destructors can't be @nogc?

2021-07-24 Thread Jim via Digitalmars-d-learn
On Saturday, 24 July 2021 at 02:02:00 UTC, Mike Parker wrote: The problem is that you've marked main as `@nogc`, and `destroy` is not `@nogc`. Remove the annotation from main and it will compile. In that case, what should we use to check functions called from `main` are not using the garbage

Destructors can't be @nogc?

2021-07-23 Thread Jim via Digitalmars-d-learn
Hello, I've been playing with D and trying to understand how to work with @nogc. I must be doing something wrong, because even though I tagged the destructor for my class `@nogc`, I'm getting the following error: `.\min.d(27): Error: "@nogc" function "D main" cannot call non-@nogc function

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:16:29 UTC, Boqsc wrote: I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. import std.stdio, std.process; void main() { writeln("Some text that will appear in cmd");

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:33:17 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:19:38 UTC, Marco de Wild wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base isn't implementing FeatureX, but foo is really a Foo which does: class Foo: Base, FeatureX { void setup

Re: Are properties mature enough?

2018-08-21 Thread Jim Balter via Digitalmars-d-learn
On Monday, 20 August 2018 at 00:49:02 UTC, Jonathan M Davis wrote: On Sunday, August 19, 2018 12:32:17 PM MDT QueenSvetlana via Digitalmars-d- learn wrote: In the D Style Guide, it says: Properties https://dlang.org/dstyle.html#properties Functions should be property functions whenever

Re: D, Parasail, Pascal, and Rust vs The Steelman

2018-08-21 Thread Jim Balter via Digitalmars-d
On Wednesday, 21 March 2018 at 16:08:07 UTC, Martin Tschierschke wrote: On Wednesday, 21 March 2018 at 12:52:19 UTC, Paulo Pinto wrote: An article comparing the above languages as per the DoD language requirements [0]. http://jedbarber.id.au/steelman.html [0] -

Re: ushort + ushort = int?

2018-08-21 Thread Jim Balter via Digitalmars-d-learn
On Monday, 20 August 2018 at 08:34:56 UTC, Andrey wrote: Hello, Here is a code that you can execute using online compiler https://run.dlang.io/: import std.stdio; void main() { ushort first = 5; ushort second = 1000; ushort result = first + second; writeln(result); } I hae

Re: Auto keyword and when to use it

2018-08-21 Thread Jim Balter via Digitalmars-d-learn
On Tuesday, 21 August 2018 at 18:18:25 UTC, QueenSvetlana wrote: On Tuesday, 21 August 2018 at 16:15:32 UTC, XavierAP wrote: Only if someone likes "Type x = new Type()" instead of "auto x = new Type()" I would say they're clearly wrong. As you stated it's up to the programmer to decided. I'm

Re: Blogpost about the T.init problem

2018-07-29 Thread Jim Balter via Digitalmars-d-announce
On Wednesday, 11 July 2018 at 16:58:53 UTC, Greatsam4sure wrote: On Tuesday, 10 July 2018 at 13:41:56 UTC, FeepingCreature wrote: [...] Every language is plague with one bug or the order. For those will great love for the language they lend a helping hand to fixed the bug. I expect you to

Re: Blogpost about the T.init problem

2018-07-29 Thread Jim Balter via Digitalmars-d-announce
On Wednesday, 11 July 2018 at 07:30:59 UTC, FeepingCreature wrote: On Tuesday, 10 July 2018 at 21:08:32 UTC, Cym13 wrote: First of all I must point that I would very much like to have seen a code actually producing an error in that article. Contrary to what is hinted just taking the struct and

Re: Blogpost about the T.init problem

2018-07-29 Thread Jim Balter via Digitalmars-d-announce
On Wednesday, 11 July 2018 at 16:54:18 UTC, Greatsam4sure wrote: On Tuesday, 10 July 2018 at 13:41:56 UTC, FeepingCreature wrote: [...] Sincerely speaking D language does not merit all these criticism. The magnitude of criticism on D language does not really make sense to me. I am yet to

Re: On D in competitive programming

2018-07-29 Thread Jim Balter via Digitalmars-d-announce
On Saturday, 28 July 2018 at 21:33:04 UTC, Ivan Kazmenko wrote: [snip] 2. When you briefly explain templates I think it's important to mention that empty parentheses may be omitted to allow the reader to make the link between function!(arg1)(arg2) and map!something. Explaining UFCS isn't

Re: Is there any good reason why C++ namespaces are "closed" in D?

2018-07-29 Thread Jim Balter via Digitalmars-d
On Sunday, 29 July 2018 at 03:20:29 UTC, Walter Bright wrote: On 7/28/2018 11:18 AM, Manu wrote: Make a PR that implements namespace as a string... I will use that fork of D forever. 1. Look how it is mangled on the C++ side. (Use "grep" on the object file.) 2. Use: pragma(mangle, "the

Re: Struct Initialization syntax

2018-07-25 Thread Jim Balter via Digitalmars-d
On Tuesday, 24 July 2018 at 16:35:32 UTC, H. S. Teoh wrote: On Tue, Jul 24, 2018 at 01:13:16PM +, Dukc via Digitalmars-d wrote: On Tuesday, 24 July 2018 at 12:37:21 UTC, Cym13 wrote: > That argument sounds quite dangerous to me, especially since > my experience is on the contrary that

Re: DIP 1016--ref T accepts r-values--Community Review Round 1

2018-07-25 Thread Jim Balter via Digitalmars-d
On Wednesday, 25 July 2018 at 08:34:30 UTC, Manu wrote: [snip] It upsets me when people present strong opinions about this who literally have no horse in the race. This is only really meaningful, and only affects you if it actually affects you... It's clearly not important to you, or you

Re: DIP 1016--ref T accepts r-values--Community Review Round 1

2018-07-25 Thread Jim Balter via Digitalmars-d
On Saturday, 21 July 2018 at 01:17:40 UTC, Jonathan M Davis wrote: On Friday, July 20, 2018 18:04:26 Manu via Digitalmars-d wrote: On Fri, 20 Jul 2018 at 18:02, Manu wrote: > [...] > > I think you're describing now a bug where a function returns > an lvalue, but it was meant to return an

Re: C's Biggest Mistake on Hacker News

2018-07-25 Thread Jim Balter via Digitalmars-d
On Monday, 23 July 2018 at 22:45:15 UTC, Walter Bright wrote: On 7/23/2018 5:39 AM, Joakim wrote: In my experience, people never learn, even from the blatantly obvious, _particularly_ when they're invested in the outdated. What inevitably happens is the new tech gets good enough to put them

Re: with and shadowing variables

2018-07-23 Thread Jim Balter via Digitalmars-d
On Sunday, 22 July 2018 at 14:05:45 UTC, Jonathan M Davis wrote: On Sunday, July 22, 2018 12:13:43 Anonymouse via Digitalmars-d wrote: Can this be made a compiler warning? struct Foo { int i; } void main() { Foo foo; with (foo) { i = 42; int i;

Re: with and shadowing variables

2018-07-23 Thread Jim Balter via Digitalmars-d
On Sunday, 22 July 2018 at 12:13:43 UTC, Anonymouse wrote: Can this be made a compiler warning? struct Foo { int i; } void main() { Foo foo; with (foo) { i = 42; int i; i = 24; } } I'm hesitant to file a bug because it'll just be immediately

Re: C's Biggest Mistake on Hacker News

2018-07-23 Thread Jim Balter via Digitalmars-d
On Sunday, 22 July 2018 at 20:10:27 UTC, Walter Bright wrote: On 7/21/2018 11:53 PM, Walter Bright wrote: My article C's Biggest Mistake on front page of https://news.ycombinator.com ! Direct link: https://news.ycombinator.com/item?id=17585357 The responses are not encouraging, but I

Re: Disabling struct destructor illegal?

2018-07-20 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 19 July 2018 at 10:04:34 UTC, RazvanN wrote: On Thursday, 19 July 2018 at 09:50:32 UTC, Jim Balter wrote: On Thursday, 19 July 2018 at 08:50:15 UTC, RazvanN wrote: struct A { int a; @disable ~this() {} } void main() { A a = A(2); } Currently, this code yields: Error

Re: Disabling struct destructor illegal?

2018-07-19 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 19 July 2018 at 08:50:15 UTC, RazvanN wrote: struct A { int a; @disable ~this() {} } void main() { A a = A(2); } Currently, this code yields: Error: destructor `A.~this` cannot be used because it is annotated with @disable I was expecting that disabling the

Re: Argon: an alternative parser for command-line arguments

2018-07-05 Thread Jim Balter via Digitalmars-d-announce
On Thursday, 3 March 2016 at 09:33:38 UTC, Johannes Pfau wrote: Am Thu, 03 Mar 2016 09:09:38 + schrieb Markus Laker : * It can open files specified at the command line. It can do a simplified version of what cat(1) does and many Perl programs so, and open a file specified by the user or

Re: Linux signal handling - notifying a condition variable

2018-03-15 Thread Jim King via Digitalmars-d
On Thursday, 15 March 2018 at 17:12:24 UTC, Adam D. Ruppe wrote: On Thursday, 15 March 2018 at 16:51:59 UTC, Jim King wrote: In going through the signal documentation it looks like the signal handler must be a "nothrow @nogc" variety. Looks like notify actually can throw an

Linux signal handling - notifying a condition variable

2018-03-15 Thread Jim King via Digitalmars-d
t a notify mechanism in a condition variable implementation perhaps could throw, but I wouldn't expect it to do any garbage collection. How is one supposed to intercept SIGINT and notify a condition variable? Is this a deficiency in the standard library? - Jim

Re: Any book recommendation for writing a compiler?

2017-11-09 Thread Jim Hewes via Digitalmars-d-learn
Thanks for those references! I'm also interested in looking through those. I had computation theory in college a long time ago but never took a compiler course. On 11/7/2017 5:26 AM, Tony wrote: Author Allen Holub has made his out-of-print book, Compiler Design in C, available as a free

Re: How about a bounty for a new windows installer using inno setup ?

2016-12-08 Thread Jim Hewes via Digitalmars-d
On 12/8/2016 3:03 AM, Thomas Mader wrote: Do you think it would be possible to use D instead of C++ to write custom code? Custom code where? During the process of building the installation package or during installation itself. Anyway, in either case I don't see why not. You can insert a

Re: How about a bounty for a new windows installer using inno setup ?

2016-12-07 Thread Jim Hewes via Digitalmars-d
u can't do. With other tools (like InstallShield) I spent too much time trying to get the tool to do something I could have done really easy at the low level if I could've just gotten to it. But granted, for simpler install situations the scripting tools can work OK and have a smaller learning curve. Jim

Re: How about a bounty for a new windows installer using inno setup ?

2016-12-06 Thread Jim Hewes via Digitalmars-d
aid, maybe it IS easy if you're just copying files and you will only ever have one configuration. So it depends. Jim

Re: How about a bounty for a new windows installer using inno setup ?

2016-12-05 Thread Jim Hewes via Digitalmars-d
s actually a combination of C# and WiX. I never found scripts to be flexible enough and it's just one more language to know. Jim

Question on syntax

2016-11-08 Thread Jim via Digitalmars-d-learn
Hi, I'm a very experienced C++ programmer, looking at a program written in D. D is similar enough to C++ and Java that I have no problem understanding it - except for one thing. I think I may have figured it out, but I want to confirm my understanding. What does it mean when a variable name

Re: Andrei's list of barriers to D adoption

2016-06-07 Thread Jim Hewes via Digitalmars-d
On 6/6/2016 9:31 AM, Shachar Shemesh wrote: With the *possible* exception of C#, none of those are systems programming languages. D presents itself as one. Shachar I think that is true. I understand that some disciplines might need to avoid a GC for whatever reason, like games or small

Re: Palindromes

2015-12-03 Thread Jim Barnett via Digitalmars-d-learn
On Friday, 4 December 2015 at 03:33:55 UTC, Meta wrote: I have never seen a language that encourages the user to specify dependencies inside a loop. I am hoping I misunderstood something here. Sorry, I thought you were referring more generally to nested imports. No, imports in a while loop

Re: Palindromes

2015-12-03 Thread Jim Barnett via Digitalmars-d-learn
On Thursday, 3 December 2015 at 22:14:02 UTC, Justin Whear wrote: I don't think you want reverse because it works in-place; you'd need to make a copy to compare against. std.range.retro is probably what you're looking for: bool isPalindrome(R)(R range) if (isBidirectionalRange!R) {

Palindromes

2015-12-03 Thread Jim Barnett via Digitalmars-d-learn
TL;DR I couldn't figure out how to write `isPalindrome` in terms of std.algorithm.mutation.reverse I have dabbled in D a few times over the past few years, but still pretty inexperienced. I decided to work on some project euler problems in D for fun. A problem requires detecting a

Re: Palindromes

2015-12-03 Thread Jim Barnett via Digitalmars-d-learn
On Friday, 4 December 2015 at 00:23:45 UTC, Jim Barnett wrote: The `import` statement inside the `for`-loop kind of smells to me. Sorry, inside the `while` loop

Re: Palindromes

2015-12-03 Thread Jim Barnett via Digitalmars-d-learn
On Thursday, 3 December 2015 at 23:42:31 UTC, Nordlöw wrote: On Thursday, 3 December 2015 at 21:40:05 UTC, Jim Barnett wrote: Thanks for reading. My version slightly adjusted version: /** Returns: If range is a palindrome larger than $(D minLength). See also: http://forum.dlang.org

Re: Palindromes

2015-12-03 Thread Jim Barnett via Digitalmars-d-learn
On Friday, 4 December 2015 at 00:50:17 UTC, Meta wrote: On Friday, 4 December 2015 at 00:26:23 UTC, Jim Barnett wrote: On Friday, 4 December 2015 at 00:23:45 UTC, Jim Barnett wrote: The `import` statement inside the `for`-loop kind of smells to me. Sorry, inside the `while` loop In D

Re: D 2015/2016 Vision?

2015-10-09 Thread Jim Hewes via Digitalmars-d
On 10/8/2015 11:56 AM, Ola Fosheim Grøstad wrote: On Thursday, 8 October 2015 at 18:19:51 UTC, Jim Hewes wrote: Yes, there are libraries, but for it to be pleasant I think language support is needed. I've linked to this video before, but it is quite entertaining if you haven't seen it yet

Re: D 2015/2016 Vision?

2015-10-08 Thread Jim Hewes via Digitalmars-d
On 10/8/2015 4:15 AM, Ola Fosheim Grøstad wrote: I personally think that they future is with actor-based programming in combination with substructural/behavioural typing since it lends itself to distributed computing, multi core etc. I've recently become curious about the actor model and would

Re: D 2015/2016 Vision?

2015-10-08 Thread Jim Hewes via Digitalmars-d
On 10/8/2015 8:51 AM, Ola Fosheim Grøstad wrote: On Thursday, 8 October 2015 at 14:13:30 UTC, Jonathan M Davis wrote: Yes, in general ownership should not be circular at all. It should be a DAG growing from the current actor/process/stack in an unbroken chain of ownership-references. +1.

Re: Shout out to D at cppcon, when talkign about ranges.

2015-09-30 Thread Jim Hewes via Digitalmars-d
I haven't watched it yet, but it seems to be similar to this one from NWCPP I watched recently: https://www.youtube.com/watch?v=8yV2ONeWXyI

Re: Current state of GUI's

2015-09-03 Thread Jim Hewes via Digitalmars-d
On 9/3/2015 10:51 AM, motaito wrote: And working in visual studio is really nice too. I wish there was a cross platform IDE like that. I don't quite like the text editor from eclipse, but I haven't used it in a while. Maybe I need to give it another try. Just in case you hadn't seen it, there

Re: Current state of GUI's

2015-09-03 Thread Jim Hewes via Digitalmars-d
On 9/3/2015 5:19 AM, motaito wrote: Hi, I haven't used D before and wanted to take a closer look at it. However, there are a few things that keep me from doing so. I'm in a similar place as you are. While D is better than C++, right now C++ plus JUCE is better for me overall than D plus .

Re: GC-proof resource classes

2015-08-30 Thread Jim Hewes via Digitalmars-d
On 8/29/2015 8:20 AM, cym13 wrote: I think there should be a separation of concerns that isn't possible right now. Freeing ressources and freeing memory isn't the same thing and they should be decoupled. I think a destructor is there to free ressources, and the GC is there to free memory. If the

Re: RAII and Deterministic Destruction

2015-08-26 Thread Jim Hewes via Digitalmars-d-learn
these various nesting/owning combinations. Jim

Re: RAII and Deterministic Destruction

2015-08-26 Thread Jim Hewes via Digitalmars-d-learn
Thanks. I had not looked at some of those yet. Jim

Re: RAII and Deterministic Destruction

2015-08-26 Thread Jim Hewes via Digitalmars-d-learn
of scope and got destructed, the reference would at least refer to valid memory although not a valid object because its destructor had already been called. Not perfectly safe, but no worse than the C++ case. Just a thought. Jim

RAII and Deterministic Destruction

2015-08-25 Thread Jim Hewes via Digitalmars-d-learn
?) Then there is std.typecons.Unique and std.typecons.RefCounted. With these, can I really get deterministic destruction for all cases like I would in C++? If so, it might be a good idea to emphasize this more in the documentation because I'd think people coming from C++ would be looking for this. Jim

Re: Announcing dplug, a toolkit for making audio plugins with D

2015-06-14 Thread Jim Hewes via Digitalmars-d-announce
On 6/13/2015 7:18 AM, ponce wrote: dplug is a library for audio plugin development. https://github.com/p0nce/dplug http://code.dlang.org/packages/dplug It's aim is to be a lean alternative to JUCE and IPlug, the most used C++ libraries in this space. It is currently less useful since

Re: What Features Should A GUI toolkit have?

2015-03-28 Thread Jim Hewes via Digitalmars-d
I'd like to see D with GUI framework like JUCE. That's what would make me use D more. For now I'll stick with C++ and JUCE. I know it sounds superficial to have your choice of language based so much on GUI, but I write software for average people to use, not for other programmers (and not for

Re: What Programming Book Should I Read Next?

2014-07-27 Thread Jim Hewes via Digitalmars-d
are in the same boat, and more so because you're more knowledgeable than me. So how do you feel about that? Jim

before D there was d

2014-07-09 Thread jim schmit via Digitalmars-d
that we called d (lower case).  fear not, i am an engineer, not a lawyer, do not sue people. my name is jim schmit.  i am a retired engineer / professor / entrepreneur / international business man / corporate executive.  I wrote my 1st program over 50 years ago.  i worked for IBM as a systems

Re: before D there was d

2014-07-09 Thread jim schmit via Digitalmars-d
On Wednesday, 9 July 2014 at 19:11:22 UTC, Andrei Alexandrescu wrote: On 7/9/14, 7:25 AM, David Gileadi wrote: Seriously though, this is a fascinating glimpse at some interesting technology and history. Many thanks for taking the time to post this here. Seconded. Thanks Jim! -- Andrei

Re: DlangUI

2014-06-14 Thread Jim Hewes via Digitalmars-d-announce
Very nice, thanks. I'm looking forward to trying it out when I can find the time. I'm not a big fan of bindings/wrappers. Jim

Re: Parallel programming paper

2014-05-18 Thread Jim Fox via Digitalmars-d
Ed, the humanistic programmer. It fits. Email me. Would like to communicate. Jim Fox (RPI Physics grad and roommate; now full bore software/database programmer/administrator LOL) On Sunday, 6 April 2008 at 01:47:20 UTC, Edward Diener wrote: Bill Baxter wrote: Has anyone heard

Re: Signals far from Slots

2014-05-08 Thread Jim Hewes via Digitalmars-d-learn
better at. BTW, thanks for your D tutorial! It's a big help to me. Jim

Signals far from Slots

2014-05-04 Thread Jim Hewes via Digitalmars-d-learn
, as in the SetBarSignalHandler() function in BarContainer. But this seems kind of ugly as all the layers need to know about the connection between the signaling object and the observer object. It would be nice if they didn't have to. Do you know any any cleaner way? Jim

Re: Call D code from C#

2014-01-12 Thread Jim Hewes
gave up for now. I may consider doing what you're doing and use C#/.Net framework for UI. Jim

Re: The Right Approach to Exceptions

2012-02-23 Thread Jim Hewes
On 2/21/2012 2:29 PM, Ali Çehreli wrote: On 02/18/2012 09:09 PM, Jim Hewes wrote: I think of exception handling as tied to contract programming. I think your use of the word 'contract' is colliding with the contract programming feature. What you describe later does not match

Re: The Right Approach to Exceptions

2012-02-19 Thread Jim Hewes
On 2/18/2012 10:50 PM, Andrei Alexandrescu wrote: On 2/18/12 11:09 PM, Jim Hewes wrote: I think there's a bit of a confusion there. In fact, I dedicated two distinct chapters to error handling and contract programming in TDPL in an attempt to dispel it. Andrei Sorry, I have not read your

Re: The Right Approach to Exceptions

2012-02-19 Thread Jim Hewes
, but what is better? Jim

Re: The Right Approach to Exceptions

2012-02-19 Thread Jim Hewes
On 2/19/2012 3:40 AM, deadalnix wrote: Le 19/02/2012 06:09, Jim Hewes a écrit : Well, I think you are messing up between contract and exception. Wrong parameters is a contract problem, not an exceptionnal situation. The exemple you cited below is way more suited for an exception : someone

Re: The Right Approach to Exceptions

2012-02-19 Thread Jim Hewes
/s620ab8x.aspx) The KeyNotFoundException is only thrown by the Item property. So, I just put this out there as an example of when a seemingly “non-exceptional” case can use exceptions depending on the contract of the function. Jim

Re: The Right Approach to Exceptions

2012-02-19 Thread Jim Hewes
handle with a switch rather than separate types. Jim

Re: The Right Approach to Exceptions

2012-02-19 Thread Jim Hewes
a packet, you expect it to get where it's going. That would be normal program flow. Otherwise it's an error and an exception. Jim

Re: The Right Approach to Exceptions

2012-02-18 Thread Jim Hewes
and then put the specific information in the exception. For example, just have one BadParameter exception and then store information about which parameter is bad and why in the exception. Jim

Re: DMD - Windows

2012-01-08 Thread Jim Hewes
On 1/7/2012 4:40 AM, Manu wrote: On 7 January 2012 08:40, Nick Sabalausky a@a.a wrote: If by 'better' languages, you mean D, then I completely disagree. D *NEEDS* an IDE, just like all the rest... and in my opinion, even more so... here are some reasons I find it so annoying there isn't a

Re: char and string with umlauts

2011-10-22 Thread Jim Danley
My thanks to everyone who responded. I learned something new, which is always a good thing, plus my program now works correctly! Take care, Jim - Original Message - From: Jonathan M Davis jmdavisp...@gmx.com To: digitalmars.D.learn digitalmars-d-learn@puremagic.com Sent: Thursday

char and string with umlauts

2011-10-20 Thread Jim Danley
? I am getting Invalid UTF-8 sequence errors. Thanks, Jim

Re: What library functionality would you most like to see in D?

2011-08-01 Thread Jim Hewes
Jacob Carlborg d...@me.com wrote in message news:j15kug$1v62$1...@digitalmars.com... On 2011-07-31 21:06, Jim Hewes wrote: For my job I work on Windows, though I try not to be an O/S fanboy and try to treat all platforms with equal credibility. But I guess one of my peeves about open source

Re: What library functionality would you most like to see in D?

2011-07-31 Thread Jim Hewes
linked and would be not too large. I confess I have not tried the existing DWT yet, mostly since I just didn't want to also download Tango. Jim

Re: Deprecated argument names

2011-03-08 Thread Jim
spir Wrote: On 03/08/2011 09:29 AM, bearophile wrote: I don't know much about Scala language, so I've found this small funny thing in the Lambda the Ultimate blog. In Scala parameter names can be deprecated: def somefunction(@deprecatedName('x) y: Int) = ... This gives

Re: Deprecated argument names

2011-03-08 Thread Jim
spir Wrote: On 03/08/2011 02:43 PM, Jim wrote: spir Wrote: On 03/08/2011 09:29 AM, bearophile wrote: I don't know much about Scala language, so I've found this small funny thing in the Lambda the Ultimate blog. In Scala parameter names can be deprecated: def somefunction

Re: Proposal for std.path replacement

2011-03-07 Thread Jim
Lars T. Kyllingstad Wrote: On Sun, 06 Mar 2011 16:49:59 -0500, Nick Sabalausky wrote: Lars T. Kyllingstad public@kyllingen.NOSPAMnet wrote in message news:il09fp$2h5d$1...@digitalmars.com... On Sun, 06 Mar 2011 15:54:19 +0100, spir wrote: What about extending the notion of 'device'

Naming convention in Phobos

2011-03-06 Thread Jim
Okay, so there's a discussion about identifier names in the proposed std.path replacement -- should they be abbreviated or not? Should we perhaps seek to have a consistent naming convention for all identifier names in Phobos? Some of the potential benefits: • Legibility, understandability and

Re: Naming convention in Phobos

2011-03-06 Thread Jim
Jonathan M Davis Wrote: On Sunday 06 March 2011 02:59:25 Jim wrote: Okay, so there's a discussion about identifier names in the proposed std.path replacement -- should they be abbreviated or not? Should we perhaps seek to have a consistent naming convention for all identifier names

Re: Proposal for std.path replacement

2011-03-06 Thread Jim
Lars T. Kyllingstad Wrote: On Sat, 05 Mar 2011 14:33:07 -0800, Jonathan M Davis wrote: On Saturday 05 March 2011 08:32:55 Lars T. Kyllingstad wrote: On Fri, 04 Mar 2011 08:14:44 -0500, Nick Sabalausky wrote: Lars T. Kyllingstad public@kyllingen.NOSPAMnet wrote in message

Re: Proposal for std.path replacement

2011-03-05 Thread Jim
Bekenn Wrote: dirSeparator -- I'd actually prefer pathSeparator, but that's not on the list. currentDirSymbol baseName dirName driveName extension stripExtension ++vote ...except that I like the current distinction between pathSeparator and dirSeparator as it is. pathSeparator

Re: Uniform Function Call Syntax(UFCS) and @property

2011-03-04 Thread Jim
Jonathan M Davis Wrote: On Thursday 03 March 2011 21:44:20 kenji hara wrote: 2011/3/4 Jonathan M Davis jmdavisp...@gmx.com: On Thursday, March 03, 2011 14:07:30 Steven Schveighoffer wrote: On Thu, 03 Mar 2011 16:56:45 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote:

Re: Uniform Function Call Syntax(UFCS) and @property

2011-03-04 Thread Jim
Jonathan M Davis Wrote: On Friday 04 March 2011 04:59:14 David Nadlinger wrote: On 3/3/11 10:27 PM, Jonathan M Davis wrote: I'd strongly argue that global/module properties make no sense. What are they a property of? The module? You could as well say: I'd strongly argue that

Re: Pretty please: Named arguments

2011-03-02 Thread Jim
Jonathan M Davis Wrote: On Tuesday, March 01, 2011 11:22:17 Bekenn wrote: On 2/28/11 1:38 PM, Don wrote: 1. It makes parameter names part of the API. I wrote earlier that this would probably be the first time parameter names leaked into user code, but I was wrong. Jacob Carlborg has

Re: Pretty please: Named arguments

2011-03-02 Thread Jim
Steven Schveighoffer Wrote: On Wed, 02 Mar 2011 08:45:43 -0500, Jason E. Aten j.e.a...@gmail.com wrote: I find this an interesting discussion. Coming from writing alot of code in language that makes extensive and highly effective use of named arguments (R), I can say that

Re: std.path.getName(): Screwy by design?

2011-03-01 Thread Jim
Nick Sabalausky Wrote: Jonathan M Davis jmdavisp...@gmx.com wrote in message news:mailman.2076.1298971012.4748.digitalmar...@puremagic.com... I think that I agree with you on all counts. I can understand if the path stuff can't deal with / or \ in file names (that's probably not worth

Re: Pretty please: Named arguments

2011-02-28 Thread Jim
Bekenn Wrote: On 2/28/11 5:48 AM, Andrei Alexandrescu wrote: One more thing, order of evaluation should still be left-to-right, not in order of arguments. This means the feature cannot be a syntactic rewrite (not a big issue, but definitely something to keep in mind). Andrei I was

Re: Pretty please: Named arguments

2011-02-28 Thread Jim
Jonathan M Davis Wrote: On Monday, February 28, 2011 14:25:05 Bekenn wrote: On 2/28/11 1:38 PM, Don wrote: spir wrote: On 02/28/2011 07:51 PM, Jonathan M Davis wrote: I'm not entirely against named arguments being in D, however I do think that any functions that actually need

Re: Better assert without changing built-in assert

2011-02-16 Thread Jim
Jens Mueller Wrote: Hi, I'm trying to improve the assertions. I tried the following auto foo(bool var) { return tuple(var, MyMessage); } void bar(bool var, string text) { } unittest { bar(foo(true).expand); //assert(foo(true).expand); // won't compile } void

Re: Better assert without changing built-in assert

2011-02-16 Thread Jim
Jens Mueller Wrote: Hi, I'm trying to improve the assertions. I tried the following auto foo(bool var) { return tuple(var, MyMessage); } void bar(bool var, string text) { } unittest { bar(foo(true).expand); //assert(foo(true).expand); // won't compile } void

Re: inlining or not inlining...

2011-02-12 Thread Jim
spir Wrote: On 02/11/2011 09:49 PM, bearophile wrote: Jim: If forced inlining is to be supported spir was asking for a list of functions that the compiled has inlined, not for a forced inlining functionality. You are (nearly) right, Bearophile. More precisely, I rather wish

Re: Stupid little iota of an idea

2011-02-12 Thread Jim
Andrei Alexandrescu Wrote: On 2/11/11 7:07 AM, foobar wrote: Andrei Alexandrescu Wrote: I don't find the name iota stupid. Andrei Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the

Re: inlining or not inlining...

2011-02-12 Thread Jim
spir Wrote: On 02/12/2011 12:15 PM, Jim wrote: Sorry about that, but I think that is a closely related discussion. @inline is certainly a verb -- even imperative mood, so not just asking for information. Why do you need information if you can't affect the outcome? I want to know

Re: inlining or not inlining...

2011-02-12 Thread Jim
ivan Wrote: Jim Wrote: spir Wrote: On 02/12/2011 12:15 PM, Jim wrote: Sorry about that, but I think that is a closely related discussion. @inline is certainly a verb -- even imperative mood, so not just asking for information. Why do you need information if you can't

Re: inlining or not inlining...

2011-02-11 Thread Jim
Jonathan M Davis Wrote: On Thursday 10 February 2011 22:35:34 Walter Bright wrote: Stewart Gordon wrote: On 09/02/2011 12:14, spir wrote: Hello, Walter states that inline annotations are useless, since programmers cannot generally know which function /should/ be inlined

  1   2   >