Re: DateTime::Duration nits...
> Ok, this is wack. When I ask the object for "delta_days" or just "days" > what is it going to give me? Uhh... the same thing it always has? Maybe I'm missing your point. We're talking about overloaded operators returning another duration object. Why would that change the return of methods? -J --
Re: DT::F::ICal format_recurrence
Quoting Dave Rolsky <[EMAIL PROTECTED]>: > This is hard, since recurrences are implemented as closures/coderefs, and > there's no way to look at one and figure out what it represents. Is it feasible, during construction, to leave enough bread crumbs around to reverse the process? (I would imagine DT::Event::ICal would be best positioned to understand the gap between the bread crumbs and actual construction) Matt
Re: DateTime::Duration nits...
On Mon, 30 Jun 2003, Joshua Hoblitt wrote: > > Why not: > > > > $dur1 = new DT::Dur( days => 2 ); > > $dur2 = new DT::Dur( months => 1 ); > > $dur3 = $dur1 - $dur2; > > $dur3->add( days => 3 ); > > > > If you add $dur3 to a date, it would add 2 days and > > subtract a month, then add 3 days again. > > > > This is not too difficult to implement. > > Is it too confusing? > > This gets my vote. It's not as 'cool' as the code-ref solution but it > is the behavior I'd expect from user defined data types. Ok, this is wack. When I ask the object for "delta_days" or just "days" what is it going to give me? Any solution needs to be something that allows the end-user to ask the object what it represents and get a reasonable, useful answer. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DT::F::ICal format_recurrence
On Mon, 30 Jun 2003, Matt Sisk wrote: > Found the parse_recurrence docs in the CVS, thanks. > > However, there's a good reason the format_recurrence method is not > documented...it doesn't exist. > > Are there plans to implement this? This is hard, since recurrences are implemented as closures/coderefs, and there's no way to look at one and figure out what it represents. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DateTime::Duration nits...
> Why not: > > $dur1 = new DT::Dur( days => 2 ); > $dur2 = new DT::Dur( months => 1 ); > $dur3 = $dur1 - $dur2; > $dur3->add( days => 3 ); > > If you add $dur3 to a date, it would add 2 days and > subtract a month, then add 3 days again. > > This is not too difficult to implement. > Is it too confusing? This gets my vote. It's not as 'cool' as the code-ref solution but it is the behavior I'd expect from user defined data types. -J --
Re: DateTime::Duration nits...
On Mon, 30 Jun 2003, Matt Sisk wrote: > > Documented or not, it'll never be intuitive, which makes me think it's a > > bad idea. > > This could be a feature of the problem space rather than implementation. :) > > I'd say it's safe to say 99% of non-temporal geeks underestimate the subtle > complexity of the problem..."intuitive" ends up being inconsistent. Right, so given two equally non-intuitive solutions you should choose the simpler one and document the beavhior... -J --
DT::F::ICal format_recurrence
Found the parse_recurrence docs in the CVS, thanks. However, there's a good reason the format_recurrence method is not documented...it doesn't exist. Are there plans to implement this? Thanks, Matt
Re: parse/format_recurrence in DT::F::ICal
They are documented in CVS version. > Is there some reason the parse/format routines for recurrences in DT::F::ICal > are not documented in the POD? Is there anyhing wrong with these methods or is > the lack of documentation an oversight?
parse/format_recurrence in DT::F::ICal
Is there some reason the parse/format routines for recurrences in DT::F::ICal are not documented in the POD? Is there anyhing wrong with these methods or is the lack of documentation an oversight? Thanks, Matt
DT Fiscal
You are right, I will move stuff around for it to be DT:Fiscal:Year
Re: DateTime::Duration nits...
> Documented or not, it'll never be intuitive, which makes me think it's a > bad idea. This could be a feature of the problem space rather than implementation. :) I'd say it's safe to say 99% of non-temporal geeks underestimate the subtle complexity of the problem..."intuitive" ends up being inconsistent. Matt (preaching to the choir)
Re: DateTime::Duration nits...
> [EMAIL PROTECTED]: > > Why not: > > > > $dur1 = new DT::Dur( days => 2 ); > > $dur2 = new DT::Dur( months => 1 ); > > $dur3 = $dur1 - $dur2; > > $dur3->add( days => 3 ); > > > > If you add $dur3 to a date, it would add 2 days and > > subtract a month, then add 3 days again. > > I love that this "does the right thing". However, I don't see why it cannot be > built into the constructor using negative values. > > The real snag is ordering, but this can be handled properly within the > constructor (and adequately documented, not only for the constructor but for the > general case). > > So, yes, the implication is that: > > $dur = DT::Dur->new(days => 2, months => -1); > > would indeed behave differently than: > > $dur = DT::Dur->new(months => -1, days => 2); > > So long as the behavior (intrinsic to durations) is well documented I think it > stands to save lots of typing later. The idea is to use: $dur = DT::Dur->new(months => -1); $dur->add(days => 2); or $dur = DT::Dur->new(months => -1)->add(days => 2); because the intention is more clear, I think. - Flavio S. Glock
Re: DateTime::Duration nits...
On Mon, 30 Jun 2003, Matt Sisk wrote: > So, yes, the implication is that: > > $dur = DT::Dur->new(days => 2, months => -1); > > would indeed behave differently than: > > $dur = DT::Dur->new(months => -1, days => 2); > > So long as the behavior (intrinsic to durations) is well documented I think it > stands to save lots of typing later. Documented or not, it'll never be intuitive, which makes me think it's a bad idea. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DateTime::Duration nits...
[EMAIL PROTECTED]: > Why not: > > $dur1 = new DT::Dur( days => 2 ); > $dur2 = new DT::Dur( months => 1 ); > $dur3 = $dur1 - $dur2; > $dur3->add( days => 3 ); > > If you add $dur3 to a date, it would add 2 days and > subtract a month, then add 3 days again. I love that this "does the right thing". However, I don't see why it cannot be built into the constructor using negative values. The real snag is ordering, but this can be handled properly within the constructor (and adequately documented, not only for the constructor but for the general case). So, yes, the implication is that: $dur = DT::Dur->new(days => 2, months => -1); would indeed behave differently than: $dur = DT::Dur->new(months => -1, days => 2); So long as the behavior (intrinsic to durations) is well documented I think it stands to save lots of typing later. Matt
Re: DateTime::Duration nits...
On Tuesday, July 1, 2003 [EMAIL PROTECTED] wrote: >Why not: > >$dur1 = new DT::Dur( days => 2 ); >$dur2 = new DT::Dur( months => 1 ); >$dur3 = $dur1 - $dur2; >$dur3->add( days => 3 ); > >If you add $dur3 to a date, it would add 2 days and >subtract a month, then add 3 days again. > >This is not too difficult to implement. >Is it too confusing? So is $dur2 above an abstracted month? That is, it isn't really resolved into a specific number of days until applied to some real start date? Likewise, how many days long is $dur3 above? It would seem like it holds the real arithmetic in suspense until added to a specific date, yes? > >On Mon, Jun 30, 2003 at 12:20:43PM -0500, Dave Rolsky >wrote: >> > 2) Having a way to construct this directly would >be nice being able >> > to make a duration that you can not directly >construct seems odd. >> >> Well, maybe. Right now the constructor is really >simple, which is good. >> More functionality is nice, but so is simplicity. > - Bruce __bruce__van_allen__santa_cruz__ca__
Re: DateTime::Duration nits...
Why not: $dur1 = new DT::Dur( days => 2 ); $dur2 = new DT::Dur( months => 1 ); $dur3 = $dur1 - $dur2; $dur3->add( days => 3 ); If you add $dur3 to a date, it would add 2 days and subtract a month, then add 3 days again. This is not too difficult to implement. Is it too confusing? - Flavio S. Glock On Mon, Jun 30, 2003 at 12:20:43PM -0500, Dave Rolsky wrote: > > 2) Having a way to construct this directly would be nice being able > > to make a duration that you can not directly construct seems odd. > > Well, maybe. Right now the constructor is really simple, which is good. > More functionality is nice, but so is simplicity.
ANNOUCE: DateTime::Format::DateManip
I needed to convert between Date::Manip and DateTime so I wrote a module to convert the date and duration formats (recurrences may follow if there is demand, there are some nasty wrinkles though). Get it from http://www.limey.net/~fiji/perl/ If people see no major problems with this module I will add it to CVS and CPAN. I also want to update the FAQ with a section on how to convert between different timezone modules, since most of the other modules use epochs that is easy to handle. I wanted to write one to convert Date::Calc::Object as well, but timezones really get ugly there. Since the TZ info is not kept with the object the user would have to tell us whether it was in local or GMT time when converting in both directions. I am still thinking about how to handle the interface in a sane manner. -ben
Re: Slides from YAPC presentation
Surely there's some coffee shops or net cafes around with wireless and/or jacks? These days it's generally gratis so long as you buy a coffee every now and then. (haven't been paying attention, so I'm not sure exactly which city we're talking about) Matt
Re: Slides from YAPC presentation
> I'm just starting to panic that I am not going to be able to survive with just a > P233 notebook with a 56k modem when I am used to a 1.2GHz w/768k DSL. ;~) I've > got a bunch of programming I want to accomplish next week and I don't want to be > hampered by poor connectivity... I'm in the same boat - on someone elses dialup. I have a new module to uplad and kinda stuck without connectivety. Starting to considering driving around to looking for freenode aps. > Does anyone know if the Marriot's "Rooms that Work" includes a network connection? I haven't been in one for years but I recall there was a USB/rj45 (yes, USB) interface. -J --
Re: DateTime::Duration nits...
On Mon, 30 Jun 2003, Ben Bennett wrote: > I am totally mystified. I read "If any of the numbers are negative, > the entire duration is negative." as indicating that the individual > signs don't matter. > > I think the error is on DT::Duration line 52: > $self->{minutes} = abs( ( $p{hours} * 60 ) + $p{minutes} ) * $self->{sign}; > Which should perhaps be: > $self->{minutes} = ( abs( $p{hours} * 60 ) + abs( $p{minutes} ) ) * $self->{sign}; Yep, looks like a bug. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DateTime::Duration nits...
On Mon, 30 Jun 2003, Flavio S. Glock wrote: > > Well, maybe. Right now the constructor is really simple, which is good. > > More functionality is nice, but so is simplicity. > > use DateTime; > my $dt = DateTime->now; > my $dur = sub { $_[0]->add( months => 3 )->subtract( hours => 3 ) }; > print $dur->($dt)->datetime; Hehe, _you_ might think that's simple but most people don't think in terms of code references, closures, etc. I think they're great, but it's not necessarily what I'd suggest for general usage. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DateTime::Duration nits...
On Mon, Jun 30, 2003 at 12:20:43PM -0500, Dave Rolsky wrote: > > 2) Having a way to construct this directly would be nice being able > > to make a duration that you can not directly construct seems odd. > > Well, maybe. Right now the constructor is really simple, which is good. > More functionality is nice, but so is simplicity. Ok, playing with this a bit more (using DateTime 0.13) makes me confused: -- my $d = DateTime::Duration->new(hours => -3, minutes => 57, seconds => 2); -- Gives 'minutes' => -123, 'seconds' => -2. -- my $d = DateTime::Duration->new(hours => 3, minutes => -57, seconds => 2); -- Gives 'minutes' => -123, 'seconds' => -2. BUT -- my $d = DateTime::Duration->new(hours => -3, minutes => -57, seconds => 2); -- Gives 'minutes' => -237, 'seconds' => -2. AND -- my $d = DateTime::Duration->new(hours => 3, minutes => 57, seconds => -2); -- Gives 'minutes' => -237, 'seconds' => -2. I am totally mystified. I read "If any of the numbers are negative, the entire duration is negative." as indicating that the individual signs don't matter. I think the error is on DT::Duration line 52: $self->{minutes} = abs( ( $p{hours} * 60 ) + $p{minutes} ) * $self->{sign}; Which should perhaps be: $self->{minutes} = ( abs( $p{hours} * 60 ) + abs( $p{minutes} ) ) * $self->{sign}; -ben
Re: DateTime::Duration nits...
Dave Rolsky wrote: > > On Mon, 30 Jun 2003, Ben Bennett wrote: > > > The nits: > > 1) The following doesn't work because add_duration() doesn't return > > the object, but rather falls through and returns the number of > > nanoseconds in the final object: > > -- > > my $dur = DateTime::Duration->new(months => 3)->add(hours => -3); > > -- > > This should be fixed so as to be consistent with DateTime.pm. > > > 2) Having a way to construct this directly would be nice being able > > to make a duration that you can not directly construct seems odd. > > Well, maybe. Right now the constructor is really simple, which is good. > More functionality is nice, but so is simplicity. use DateTime; my $dt = DateTime->now; my $dur = sub { $_[0]->add( months => 3 )->subtract( hours => 3 ) }; print $dur->($dt)->datetime; - Flavio S. Glock
Re: DateTime::Duration nits...
On Mon, 30 Jun 2003, Ben Bennett wrote: > The nits: > 1) The following doesn't work because add_duration() doesn't return > the object, but rather falls through and returns the number of > nanoseconds in the final object: > -- > my $dur = DateTime::Duration->new(months => 3)->add(hours => -3); > -- This should be fixed so as to be consistent with DateTime.pm. > 2) Having a way to construct this directly would be nice being able > to make a duration that you can not directly construct seems odd. Well, maybe. Right now the constructor is really simple, which is good. More functionality is nice, but so is simplicity. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
DateTime::Duration nits...
I want to create a duration that represents 3 hours shy of 3 months. There is no way to do this directly using the new() constructor (Date::Manip has 2 effective signs, one on years and months and the other on weeks, days, hours, minutes and seconds). You can get this by doing: -- my $dur = DateTime::Duration->new(months => 3); $dur->add(hours => -3); -- The nits: 1) The following doesn't work because add_duration() doesn't return the object, but rather falls through and returns the number of nanoseconds in the final object: -- my $dur = DateTime::Duration->new(months => 3)->add(hours => -3); -- 2) Having a way to construct this directly would be nice being able to make a duration that you can not directly construct seems odd. -ben
Re: OSCON
On Sun, 29 Jun 2003, Joshua Hoblitt wrote: > I just noticed your on MJD's lightning talk list for OSCON. What are > you going to cram into 5 minutes? :) Um, I dunno. I figured I'd write it that day or something. I'm mostly planning on just telling people what the project is and why it's a good thing. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: Slides from YAPC presentation
Joshua Hoblitt wrote: Are you in town yet? I've instigated a pdx.pm GT either Tues. or Weds. of this week. Nope. I'll be getting in Saturday night (and probably wiped out until Sunday morning). I'm open to suggestions of what to do on Sunday, though I won't be getting a car unless provoked. I'm just starting to panic that I am not going to be able to survive with just a P233 notebook with a 56k modem when I am used to a 1.2GHz w/768k DSL. ;~) I've got a bunch of programming I want to accomplish next week and I don't want to be hampered by poor connectivity... Does anyone know if the Marriot's "Rooms that Work" includes a network connection? John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747
Re: [Module-build-general] RE: yet another DT::F::ISO8601 with yet another version (fwd)
Joshua Hoblitt wrote: > But it generates a makefile on win32 that calls Build so you can > still use make, right? So the question is why does 'nmake' succeed > and 'nmake test' fail? This has been fixed in latest CVS. Basically, it was generating a GNU makefile, not a "lowest common denominator" one. See http://sourceforge.net/mailarchive/forum.php?thread_id=2557220&forum_id=10905 for more details. /-\ http://mobile.yahoo.com.au - Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile.
OSCON
Dave, I just noticed your on MJD's lightning talk list for OSCON. What are you going to cram into 5 minutes? :) -J --
Re: Slides from YAPC presentation
Are you in town yet? I've instigated a pdx.pm GT either Tues. or Weds. of this week. -J --