'foo' asTime

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
50 messages Options
123
Reply | Threaded
Open this post in threaded view
|

'foo' asTime

Philippe Marschall-2-3
Guess what it does.

Not what I expect it to do.

Cheers
Philippe


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
The kind of think I hate.
       
        Time readFrom: aString
I will deprecate it.

I would really like to have the approach proposed by K. Beck on conversion methods.
Conversion methods for API compatible objects. Of course it will lead to less compact program (URL readFrom: 'http://' instead of 'http://' url) but avoids a lot of code in String (of course class extensions limit the plague).


Stef

> Guess what it does.
>
> Not what I expect it to do.
>
> Cheers
> Philippe
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Brent Pinkney-2
> I would really like to have the approach proposed by K. Beck on conversion
> methods. Conversion methods for API compatible objects. Of course it will
> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
> url) but avoids a lot of code in String (of course class extensions limit
> the plague).

Hi, please reconsider this. There is just no way (Duration seconds: 3) is
better than '3 seconds'.

This smacks of working for the computer instead of the other way around.

Brent

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Fernando olivero-2
humm...I agree with Kent Beck and Stef, because conceptually a String shouldnt know how to answer #seconds.

Maybe its a matter of having better interactions, smarter text morphs , than introducing this in the "model".

Fernando


On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:

>> I would really like to have the approach proposed by K. Beck on conversion
>> methods. Conversion methods for API compatible objects. Of course it will
>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>> url) but avoids a lot of code in String (of course class extensions limit
>> the plague).
>
> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> better than '3 seconds'.
>
> This smacks of working for the computer instead of the other way around.
>
> Brent
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Mariano Martinez Peck


On Mon, Aug 23, 2010 at 9:07 AM, Fernando olivero <[hidden email]> wrote:
humm...I agree with Kent Beck and Stef, because conceptually a String shouldnt know how to answer #seconds.

Maybe its a matter of having better interactions, smarter text morphs , than introducing this in the "model".



maybe where are discussing what we prefer...if nice in words/language or better in OOP.

For example, I may (not sure) agree Number understands #seconds. But I may think also that a better OOP would not Number understand #seconds but stead have Duration seconds: 3

But...'3 seconds' is nicer...it is more similar to our language.

 
Fernando


On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:

>> I would really like to have the approach proposed by K. Beck on conversion
>> methods. Conversion methods for API compatible objects. Of course it will
>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>> url) but avoids a lot of code in String (of course class extensions limit
>> the plague).
>
> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> better than '3 seconds'.
>
> This smacks of working for the computer instead of the other way around.
>
> Brent
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Johan Brichau-2

I agree that String>>asTime is an accident waiting to happen. It's not that much effort to use the following: Time readFromString: aString

But there is a problem with the readFromString: method as well.
At the very least, if the string does not represent a valid time, it should throw an error.


On 23 Aug 2010, at 09:16, Mariano Martinez Peck wrote:

>
>
> On Mon, Aug 23, 2010 at 9:07 AM, Fernando olivero <[hidden email]> wrote:
> humm...I agree with Kent Beck and Stef, because conceptually a String shouldnt know how to answer #seconds.
>
> Maybe its a matter of having better interactions, smarter text morphs , than introducing this in the "model".
>
>
>
> maybe where are discussing what we prefer...if nice in words/language or better in OOP.
>
> For example, I may (not sure) agree Number understands #seconds. But I may think also that a better OOP would not Number understand #seconds but stead have Duration seconds: 3
>
> But...'3 seconds' is nicer...it is more similar to our language.
>
>  
> Fernando
>
>
> On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:
>
> >> I would really like to have the approach proposed by K. Beck on conversion
> >> methods. Conversion methods for API compatible objects. Of course it will
> >> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
> >> url) but avoids a lot of code in String (of course class extensions limit
> >> the plague).
> >
> > Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> > better than '3 seconds'.
> >
> > This smacks of working for the computer instead of the other way around.
> >
> > Brent
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

laurent laffont
In reply to this post by Mariano Martinez Peck
2010/8/23 Mariano Martinez Peck <[hidden email]>


On Mon, Aug 23, 2010 at 9:07 AM, Fernando olivero <[hidden email]> wrote:
humm...I agree with Kent Beck and Stef, because conceptually a String shouldnt know how to answer #seconds.

Maybe its a matter of having better interactions, smarter text morphs , than introducing this in the "model".



maybe where are discussing what we prefer...if nice in words/language or better in OOP.

For example, I may (not sure) agree Number understands #seconds. But I may think also that a better OOP would not Number understand #seconds but stead have Duration seconds: 3

But...'3 seconds' is nicer...it is more similar to our language.



Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.

Laurent

 

 
Fernando


On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:

>> I would really like to have the approach proposed by K. Beck on conversion
>> methods. Conversion methods for API compatible objects. Of course it will
>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>> url) but avoids a lot of code in String (of course class extensions limit
>> the plague).
>
> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> better than '3 seconds'.
>
> This smacks of working for the computer instead of the other way around.
>
> Brent
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Marcus Denker-4

On Aug 23, 2010, at 9:40 AM, laurent laffont wrote:


Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.


And I think the reason is the following:

 '2010/08/01' asTime

this is just code... "string, you smalltalk object, please convert yourself into an object of another class that
you normally should know too much about". No reason why not to ask the Time class: hey, time,
I have a string, can you make a time for me? And it's even nicer... Time knows about time, string
about being a string.

BUT:

1 second + 3 hours

This is different. This is a *domain specific language* for dealing with time. When you read that, you do
not think in term of general smalltalk code for coverting between classes. We are (kind of) outside of
our language model and the rules we normally follow do not apply. (e.g. there is no hour and second class...). 

Domain specific languages are powerful, and one can abuse them very easily. 
(am guilty of having written once some awful DSL where even the *name* of a block 
parameter had semantic meaning ;-)

         Marcus

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
In reply to this post by Johan Brichau-2

On Aug 23, 2010, at 9:39 AM, Johan Brichau wrote:

>
> I agree that String>>asTime is an accident waiting to happen. It's not that much effort to use the following: Time readFromString: aString
>
> But there is a problem with the readFromString: method as well.
> At the very least, if the string does not represent a valid time, it should throw an error.

yes

>
>
> On 23 Aug 2010, at 09:16, Mariano Martinez Peck wrote:
>
>>
>>
>> On Mon, Aug 23, 2010 at 9:07 AM, Fernando olivero <[hidden email]> wrote:
>> humm...I agree with Kent Beck and Stef, because conceptually a String shouldnt know how to answer #seconds.
>>
>> Maybe its a matter of having better interactions, smarter text morphs , than introducing this in the "model".
>>
>>
>>
>> maybe where are discussing what we prefer...if nice in words/language or better in OOP.
>>
>> For example, I may (not sure) agree Number understands #seconds. But I may think also that a better OOP would not Number understand #seconds but stead have Duration seconds: 3
>>
>> But...'3 seconds' is nicer...it is more similar to our language.
>>
>>
>> Fernando
>>
>>
>> On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:
>>
>>>> I would really like to have the approach proposed by K. Beck on conversion
>>>> methods. Conversion methods for API compatible objects. Of course it will
>>>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>>>> url) but avoids a lot of code in String (of course class extensions limit
>>>> the plague).
>>>
>>> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
>>> better than '3 seconds'.
>>>
>>> This smacks of working for the computer instead of the other way around.
>>>
>>> Brent
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
In reply to this post by Brent Pinkney-2
3 seconds is indeed better.
Right now we are talking about string over extension.

Stef

On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:

>> I would really like to have the approach proposed by K. Beck on conversion
>> methods. Conversion methods for API compatible objects. Of course it will
>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>> url) but avoids a lot of code in String (of course class extensions limit
>> the plague).
>
> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> better than '3 seconds'.
>
> This smacks of working for the computer instead of the other way around.
>
> Brent
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
In reply to this post by laurent laffont
Yes!


> On Mon, Aug 23, 2010 at 9:07 AM, Fernando olivero <[hidden email]> wrote:
> humm...I agree with Kent Beck and Stef, because conceptually a String shouldnt know how to answer #seconds.
>
> Maybe its a matter of having better interactions, smarter text morphs , than introducing this in the "model".
>
>
>
> maybe where are discussing what we prefer...if nice in words/language or better in OOP.
>
> For example, I may (not sure) agree Number understands #seconds. But I may think also that a better OOP would not Number understand #seconds but stead have Duration seconds: 3
>
> But...'3 seconds' is nicer...it is more similar to our language.
>
>
> What do you think of http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Numeric/Time.html ?
>
> Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.
>
> Laurent
>
>  
>
>  
> Fernando
>
>
> On Aug 23, 2010, at 9:00 AM, Brent Pinkney wrote:
>
> >> I would really like to have the approach proposed by K. Beck on conversion
> >> methods. Conversion methods for API compatible objects. Of course it will
> >> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
> >> url) but avoids a lot of code in String (of course class extensions limit
> >> the plague).
> >
> > Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> > better than '3 seconds'.
> >
> > This smacks of working for the computer instead of the other way around.
> >
> > Brent
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

laurent laffont
In reply to this post by Marcus Denker-4


2010/8/23 Marcus Denker <[hidden email]>

On Aug 23, 2010, at 9:40 AM, laurent laffont wrote:


Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.


And I think the reason is the following:

 '2010/08/01' asTime

this is just code... "string, you smalltalk object, please convert yourself into an object of another class that
you normally should know too much about". No reason why not to ask the Time class: hey, time,
I have a string, can you make a time for me? And it's even nicer... Time knows about time, string
about being a string.


Yes. So I think I should avoid to show 'http://www.google.com' asUrl in pharocasts......


Laurent


 

BUT:

1 second + 3 hours

This is different. This is a *domain specific language* for dealing with time. When you read that, you do
not think in term of general smalltalk code for coverting between classes. We are (kind of) outside of
our language model and the rules we normally follow do not apply. (e.g. there is no hour and second class...). 

Domain specific languages are powerful, and one can abuse them very easily. 
(am guilty of having written once some awful DSL where even the *name* of a block 
parameter had semantic meaning ;-)

         Marcus

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Gary Chambers-4
In reply to this post by Brent Pinkney-2
+1

One of our developers recently complained of #asInteger being removed from
ByteArray for instance...

Regards, Gary

----- Original Message -----
From: "Brent Pinkney" <[hidden email]>
To: <[hidden email]>
Sent: Monday, August 23, 2010 8:00 AM
Subject: Re: [Pharo-project] 'foo' asTime


>> I would really like to have the approach proposed by K. Beck on
>> conversion
>> methods. Conversion methods for API compatible objects. Of course it will
>> lead to less compact program (URL readFrom: 'http://' instead of
>> 'http://'
>> url) but avoids a lot of code in String (of course class extensions limit
>> the plague).
>
> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
> better than '3 seconds'.
>
> This smacks of working for the computer instead of the other way around.
>
> Brent
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
what is #[12 35] asInteger?

Stef

On Aug 23, 2010, at 11:52 AM, Gary Chambers wrote:

> +1
>
> One of our developers recently complained of #asInteger being removed from ByteArray for instance...
>
> Regards, Gary
>
> ----- Original Message ----- From: "Brent Pinkney" <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, August 23, 2010 8:00 AM
> Subject: Re: [Pharo-project] 'foo' asTime
>
>
>>> I would really like to have the approach proposed by K. Beck on conversion
>>> methods. Conversion methods for API compatible objects. Of course it will
>>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>>> url) but avoids a lot of code in String (of course class extensions limit
>>> the plague).
>>
>> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
>> better than '3 seconds'.
>>
>> This smacks of working for the computer instead of the other way around.
>>
>> Brent
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
In reply to this post by laurent laffont
yes!
I did not say anything the last time because I did not want to break the fun.

>
>
> 2010/8/23 Marcus Denker <[hidden email]>
>
> On Aug 23, 2010, at 9:40 AM, laurent laffont wrote:
>>
>>
>> Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.
>>
>
> And I think the reason is the following:
>
>  '2010/08/01' asTime
>
> this is just code... "string, you smalltalk object, please convert yourself into an object of another class that
> you normally should know too much about". No reason why not to ask the Time class: hey, time,
> I have a string, can you make a time for me? And it's even nicer... Time knows about time, string
> about being a string.
>
>
> Yes. So I think I should avoid to show 'http://www.google.com' asUrl in pharocasts......
>
>
> Laurent
>
>
>  
>
> BUT:
>
> 1 second + 3 hours
>
> This is different. This is a *domain specific language* for dealing with time. When you read that, you do
> not think in term of general smalltalk code for coverting between classes. We are (kind of) outside of
> our language model and the rules we normally follow do not apply. (e.g. there is no hour and second class...).
>
> Domain specific languages are powerful, and one can abuse them very easily.
> (am guilty of having written once some awful DSL where even the *name* of a block
> parameter had semantic meaning ;-)
>
>          Marcus
>
> --
> Marcus Denker  -- http://www.marcusdenker.de
> INRIA Lille -- Nord Europe. Team RMoD.
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse
In reply to this post by Gary Chambers-4
#[12 35] asInteger
         is not in 1.0, 1.1, and 1.2
        It does not work in squeak trunk either
        did not work in 3.9 either.
So I'm puzzled.

Now everybody can create his own personal package with the extensions they like.

Stef

On Aug 23, 2010, at 11:52 AM, Gary Chambers wrote:

> +1
>
> One of our developers recently complained of #asInteger being removed from ByteArray for instance...
>
> Regards, Gary
>
> ----- Original Message ----- From: "Brent Pinkney" <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, August 23, 2010 8:00 AM
> Subject: Re: [Pharo-project] 'foo' asTime
>
>
>>> I would really like to have the approach proposed by K. Beck on conversion
>>> methods. Conversion methods for API compatible objects. Of course it will
>>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>>> url) but avoids a lot of code in String (of course class extensions limit
>>> the plague).
>>
>> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
>> better than '3 seconds'.
>>
>> This smacks of working for the computer instead of the other way around.
>>
>> Brent
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

laurent laffont
In reply to this post by Stéphane Ducasse
On Mon, Aug 23, 2010 at 11:57 AM, Stéphane Ducasse <[hidden email]> wrote:
yes!
I did not say anything the last time because I did not want to break the fun.

Don't hesitate to put some "Guru" tips in comments. Because it's really hard to know its own misconceptions :)

I don't think it would break the fun (well.... unless you write "stupid idiot bastard don't use String>>#asUrl burn in hell !!!") but bring emulation.

Laurent

 

>
>
> 2010/8/23 Marcus Denker <[hidden email]>
>
> On Aug 23, 2010, at 9:40 AM, laurent laffont wrote:
>>
>>
>> Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.
>>
>
> And I think the reason is the following:
>
>  '2010/08/01' asTime
>
> this is just code... "string, you smalltalk object, please convert yourself into an object of another class that
> you normally should know too much about". No reason why not to ask the Time class: hey, time,
> I have a string, can you make a time for me? And it's even nicer... Time knows about time, string
> about being a string.
>
>
> Yes. So I think I should avoid to show 'http://www.google.com' asUrl in pharocasts......
>
>
> Laurent
>
>
>
>
> BUT:
>
> 1 second + 3 hours
>
> This is different. This is a *domain specific language* for dealing with time. When you read that, you do
> not think in term of general smalltalk code for coverting between classes. We are (kind of) outside of
> our language model and the rules we normally follow do not apply. (e.g. there is no hour and second class...).
>
> Domain specific languages are powerful, and one can abuse them very easily.
> (am guilty of having written once some awful DSL where even the *name* of a block
> parameter had semantic meaning ;-)
>
>          Marcus
>
> --
> Marcus Denker  -- http://www.marcusdenker.de
> INRIA Lille -- Nord Europe. Team RMoD.
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Gary Chambers-4
In reply to this post by Stéphane Ducasse
He was porting his stuff from Squeak 3.9

3107 apparently.

c.f.
    #(12 35) asByteArray asInteger asByteArray

Unfortunately heavily used when doing low-level stuff with external devices
socket data etc.
(let us not get into endianess either though ;-) )

Regards, Gary

----- Original Message -----
From: "Stéphane Ducasse" <[hidden email]>
To: <[hidden email]>
Sent: Monday, August 23, 2010 11:01 AM
Subject: Re: [Pharo-project] 'foo' asTime


> #[12 35] asInteger
> is not in 1.0, 1.1, and 1.2
> It does not work in squeak trunk either
> did not work in 3.9 either.
> So I'm puzzled.
>
> Now everybody can create his own personal package with the extensions they
> like.
>
> Stef
>
> On Aug 23, 2010, at 11:52 AM, Gary Chambers wrote:
>
>> +1
>>
>> One of our developers recently complained of #asInteger being removed
>> from ByteArray for instance...
>>
>> Regards, Gary
>>
>> ----- Original Message ----- From: "Brent Pinkney" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Monday, August 23, 2010 8:00 AM
>> Subject: Re: [Pharo-project] 'foo' asTime
>>
>>
>>>> I would really like to have the approach proposed by K. Beck on
>>>> conversion
>>>> methods. Conversion methods for API compatible objects. Of course it
>>>> will
>>>> lead to less compact program (URL readFrom: 'http://' instead of
>>>> 'http://'
>>>> url) but avoids a lot of code in String (of course class extensions
>>>> limit
>>>> the plague).
>>>
>>> Hi, please reconsider this. There is just no way (Duration seconds: 3)
>>> is
>>> better than '3 seconds'.
>>>
>>> This smacks of working for the computer instead of the other way around.
>>>
>>> Brent
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Stéphane Ducasse

On Aug 23, 2010, at 12:21 PM, Gary Chambers wrote:

> He was porting his stuff from Squeak 3.9
>
> 3107 apparently.
>
> c.f.
>   #(12 35) asByteArray asInteger asByteArray


This is what I tried
        #(12 35) asByteArray asInteger on my old 3.9 7067 final image and it barks.
Then a nice explicit loops should make it too.

Stef

>
> Unfortunately heavily used when doing low-level stuff with external devices socket data etc.
> (let us not get into endianess either though ;-) )
>
> Regards, Gary
>
> ----- Original Message ----- From: "Stéphane Ducasse" <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, August 23, 2010 11:01 AM
> Subject: Re: [Pharo-project] 'foo' asTime
>
>
>> #[12 35] asInteger
>> is not in 1.0, 1.1, and 1.2
>> It does not work in squeak trunk either
>> did not work in 3.9 either.
>> So I'm puzzled.
>>
>> Now everybody can create his own personal package with the extensions they like.
>>
>> Stef
>>
>> On Aug 23, 2010, at 11:52 AM, Gary Chambers wrote:
>>
>>> +1
>>>
>>> One of our developers recently complained of #asInteger being removed from ByteArray for instance...
>>>
>>> Regards, Gary
>>>
>>> ----- Original Message ----- From: "Brent Pinkney" <[hidden email]>
>>> To: <[hidden email]>
>>> Sent: Monday, August 23, 2010 8:00 AM
>>> Subject: Re: [Pharo-project] 'foo' asTime
>>>
>>>
>>>>> I would really like to have the approach proposed by K. Beck on conversion
>>>>> methods. Conversion methods for API compatible objects. Of course it will
>>>>> lead to less compact program (URL readFrom: 'http://' instead of 'http://'
>>>>> url) but avoids a lot of code in String (of course class extensions limit
>>>>> the plague).
>>>>
>>>> Hi, please reconsider this. There is just no way (Duration seconds: 3) is
>>>> better than '3 seconds'.
>>>>
>>>> This smacks of working for the computer instead of the other way around.
>>>>
>>>> Brent
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: 'foo' asTime

Gary Chambers-4
Odd, my 3.9 works.

Method ByteArray>>asInteger by "len 10/15/2002 18:45"

Regards, Gary

----- Original Message -----
From: "Stéphane Ducasse" <[hidden email]>
To: <[hidden email]>
Sent: Monday, August 23, 2010 11:33 AM
Subject: Re: [Pharo-project] 'foo' asTime



On Aug 23, 2010, at 12:21 PM, Gary Chambers wrote:

> He was porting his stuff from Squeak 3.9
>
> 3107 apparently.
>
> c.f.
>   #(12 35) asByteArray asInteger asByteArray


This is what I tried
#(12 35) asByteArray asInteger on my old 3.9 7067 final image and it barks.
Then a nice explicit loops should make it too.

Stef

>
> Unfortunately heavily used when doing low-level stuff with external
> devices socket data etc.
> (let us not get into endianess either though ;-) )
>
> Regards, Gary
>
> ----- Original Message ----- From: "Stéphane Ducasse"
> <[hidden email]>
> To: <[hidden email]>
> Sent: Monday, August 23, 2010 11:01 AM
> Subject: Re: [Pharo-project] 'foo' asTime
>
>
>> #[12 35] asInteger
>> is not in 1.0, 1.1, and 1.2
>> It does not work in squeak trunk either
>> did not work in 3.9 either.
>> So I'm puzzled.
>>
>> Now everybody can create his own personal package with the extensions
>> they like.
>>
>> Stef
>>
>> On Aug 23, 2010, at 11:52 AM, Gary Chambers wrote:
>>
>>> +1
>>>
>>> One of our developers recently complained of #asInteger being removed
>>> from ByteArray for instance...
>>>
>>> Regards, Gary
>>>
>>> ----- Original Message ----- From: "Brent Pinkney" <[hidden email]>
>>> To: <[hidden email]>
>>> Sent: Monday, August 23, 2010 8:00 AM
>>> Subject: Re: [Pharo-project] 'foo' asTime
>>>
>>>
>>>>> I would really like to have the approach proposed by K. Beck on
>>>>> conversion
>>>>> methods. Conversion methods for API compatible objects. Of course it
>>>>> will
>>>>> lead to less compact program (URL readFrom: 'http://' instead of
>>>>> 'http://'
>>>>> url) but avoids a lot of code in String (of course class extensions
>>>>> limit
>>>>> the plague).
>>>>
>>>> Hi, please reconsider this. There is just no way (Duration seconds: 3)
>>>> is
>>>> better than '3 seconds'.
>>>>
>>>> This smacks of working for the computer instead of the other way
>>>> around.
>>>>
>>>> Brent
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
123