octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using exceptions in the core


From: Mike Miller
Subject: Re: Using exceptions in the core
Date: Tue, 6 Oct 2015 23:15:00 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Oct 06, 2015 at 15:13:17 -0400, John W. Eaton wrote:
> On 10/02/2015 06:14 PM, John W. Eaton wrote:
> >My current idea is attached.  With it, you can write something like
> >
> >   std::string url = args(0).string_value ("urlwrite: URL must be a
> >string");
> >
> >Comments?
> 
> Any comments on this proposal?

I like the overall concept, makes the code more direct and easier to
understand and maintain. My nit to pick is that the calling convention
is not very clear:

  std::string octave_value::string_value (const std::string& msg);

Looking at the class definition of octave_value, it's not at all clear
what the difference is between the two string_value methods, or why one
would be preferred over the other.

Should this error-state-setting variant be called something else? Or
should this be the way more functions are going to tend to go? For this
specific case, I see that string_value(true) is never used in Octave,
should this new method replace that one completely?

I still think it's a little weird to say "convert to a string for me,
here's an error message just in case", is there really no better way?

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]