postgresql version 9.1 problem

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

postgresql version 9.1 problem

Steve Whitson
Hi,

I've come across a problem when using postgresql version 9.1 (using visualworks 7.7.1)

We have a couple methods named \\

In postgresql versions 7.x - 9.0 this has been working just fine (replicates, publishes, and loads, all ok)...  now in 9.1 the method name becomes \\\\ when replicated or published (not something we did... something that postgresql 9.1 did is what I'd presume).  This is not something we want to have happen.

If I attempt to load the package that contains the \\\\ method then the \\ method is removed from my image (as expected) but \\\\ is not loaded.

Has anyone else seen anything like this?  Ideas?

Thanks much,
    -Steve


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Steve Whitson
I failed to mention that I do have the "bytea_output = 'escape'" in my postgresql.conf file (the fix for 9.0).

On 5/14/2012 10:33 AM, Steve Whitson wrote:
Hi,

I've come across a problem when using postgresql version 9.1 (using visualworks 7.7.1)

We have a couple methods named \\

In postgresql versions 7.x - 9.0 this has been working just fine (replicates, publishes, and loads, all ok)...  now in 9.1 the method name becomes \\\\ when replicated or published (not something we did... something that postgresql 9.1 did is what I'd presume).  This is not something we want to have happen.

If I attempt to load the package that contains the \\\\ method then the \\ method is removed from my image (as expected) but \\\\ is not loaded.

Has anyone else seen anything like this?  Ideas?

Thanks much,
    -Steve



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Niall Ross
Dear Steve,
Dan D'Eramo located the cause: PostgreSQL 9.1's fix

"Change the default value of standard_conforming_strings to on (Robert
Haas): by default, backslashes are now ordinary characters in string
literals, not escape characters. This change removes a long-standing
incompatibility with the SQL standard. escape_string_warning has
produced warnings about this usage for years. E” strings are the proper
way to embed backslash escapes in strings and are unaffected by this
change. WARNING This change can break applications that are not
expecting it and do their own string escaping according to the old
rules. ..."

(From a quick glance) the method
PostgreSQLEXDIStringValue>>stringFromObject does exactly this in-app
behaviour in our Postgres (I should say Bruce Badger's Postgres).

Dan is working on a resolution for our existing releases. A fix will
also go into 7.9.1 and 7.10 (almost certainly far too late for 7.9 at
this point - the resolution will therefore apply to 7.9 as well).

Thanks for info
Niall Ross

> I failed to mention that I do have the "bytea_output = 'escape'" in my
> postgresql.conf file (the fix for 9.0).
>
> On 5/14/2012 10:33 AM, Steve Whitson wrote:
>
>> Hi,
>>
>> I've come across a problem when using postgresql version 9.1 (using
>> visualworks 7.7.1)
>>
>> We have a couple methods named _\\_
>>
>> In postgresql versions 7.x - 9.0 this has been working just fine
>> (replicates, publishes, and loads, all ok)... now in 9.1 the method
>> name becomes _\\\\_ when replicated or published (not something we
>> did... something that postgresql 9.1 did is what I'd presume). This
>> is not something we want to have happen.
>>
>> If I attempt to load the package that contains the _\\\\_ method then
>> the _\\_ method is removed from my image (as expected) but _\\\\_ is
>> not loaded.
>>
>> Has anyone else seen anything like this? Ideas?
>>
>> Thanks much,
>> -Steve
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Conrad Taylor
On Mon, May 14, 2012 at 1:04 PM, Niall Ross <[hidden email]> wrote:
Dear Steve,
Dan D'Eramo located the cause: PostgreSQL 9.1's fix

"Change the default value of standard_conforming_strings to on (Robert
Haas): by default, backslashes are now ordinary characters in string
literals, not escape characters. This change removes a long-standing
incompatibility with the SQL standard. escape_string_warning has
produced warnings about this usage for years. E” strings are the proper
way to embed backslash escapes in strings and are unaffected by this
change. WARNING This change can break applications that are not
expecting it and do their own string escaping according to the old
rules. ..."

(From a quick glance) the method
PostgreSQLEXDIStringValue>>stringFromObject does exactly this in-app
behaviour in our Postgres (I should say Bruce Badger's Postgres).

Dan is working on a resolution for our existing releases. A fix will
also go into 7.9.1 and 7.10 (almost certainly far too late for 7.9 at
this point - the resolution will therefore apply to 7.9 as well).


Niall, is there any particular reason why this fix isn't being applied to 7.9?  Also, Is there a mechanism similar to Software Update on Mac OS X for updating Cincom Smalltalk?  If not, is there way to manually apply his fix prior to an official release?  I'm just wondering if there's a faster way to expedite these type of fixes as well as other software updates for Cincom Smalltalk (i.e. VisualWorks -> Check for Updates...).

About VisualWorks
--------------------------------
Preferences          ⌘,
--------------------------------
License...
Register...
Check for Updates...
__________________

and so on

Thanks for info
Niall Ross

> I failed to mention that I do have the "bytea_output = 'escape'" in my
> postgresql.conf file (the fix for 9.0).
>
> On 5/14/2012 10:33 AM, Steve Whitson wrote:
>
>> Hi,
>>
>> I've come across a problem when using postgresql version 9.1 (using
>> visualworks 7.7.1)
>>
>> We have a couple methods named _\\_
>>
>> In postgresql versions 7.x - 9.0 this has been working just fine
>> (replicates, publishes, and loads, all ok)... now in 9.1 the method
>> name becomes _\\\\_ when replicated or published (not something we
>> did... something that postgresql 9.1 did is what I'd presume). This
>> is not something we want to have happen.
>>
>> If I attempt to load the package that contains the _\\\\_ method then
>> the _\\_ method is removed from my image (as expected) but _\\\\_ is
>> not loaded.
>>
>> Has anyone else seen anything like this? Ideas?
>>
>> Thanks much,
>> -Steve
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



--

Think different and code well,

-Conrad



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Maarten Mostert
In reply to this post by Niall Ross

Niall,  Steve,

 

Are we talking all postgres or Store only here ?

 

Thanks,

 

Maarten,

 

-----Original Message-----
From: "Niall Ross" <[hidden email]>
Sent: Monday, 14 May, 2012 22:04
To: "Steve Whitson" <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Subject: Re: [vwnc] postgresql version 9.1 problem

Dear Steve,
Dan D'Eramo located the cause: PostgreSQL 9.1's fix

"Change the default value of standard_conforming_strings to on (Robert
Haas): by default, backslashes are now ordinary characters in string
literals, not escape characters. This change removes a long-standing
incompatibility with the SQL standard. escape_string_warning has
produced warnings about this usage for years. E” strings are the proper
way to embed backslash escapes in strings and are unaffected by this
change. WARNING This change can break applications that are not
expecting it and do their own string escaping according to the old
rules. ..."

(From a quick glance) the method
PostgreSQLEXDIStringValue>>stringFromObject does exactly this in-app
behaviour in our Postgres (I should say Bruce Badger's Postgres).

Dan is working on a resolution for our existing releases. A fix will
also go into 7.9.1 and 7.10 (almost certainly far too late for 7.9 at
this point - the resolution will therefore apply to 7.9 as well).

Thanks for info
Niall Ross


> I failed to mention that I do have the "bytea_output = 'escape'" in my
> postgresql.conf file (the fix for 9.0).
>
> On 5/14/2012 10:33 AM, Steve Whitson wrote:
>
>> Hi,
>>
>> I've come across a problem when using postgresql version 9.1 (using
>> visualworks 7.7.1)
>>
>> We have a couple methods named _\\_
>>
>> In postgresql versions 7.x - 9.0 this has been working just fine
>> (replicates, publishes, and loads, all ok)... now in 9.1 the method
>> name becomes _\\\\_ when replicated or published (not something we
>> did... something that postgresql 9.1 did is what I'd presume). This
>> is not something we want to have happen.
>>
>> If I attempt to load the package that contains the _\\\\_ method then
>> the _\\_ method is removed from my image (as expected) but _\\\\_ is
>> not loaded.
>>
>> Has anyone else seen anything like this? Ideas?
>>
>> Thanks much,
>> -Steve
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Niall Ross
Niall,

Supposedly, the short term fix is to then set both,

standard_conforming_strings = off
bytea_output = 'escape'

in postgresql.conf to get Store working in 9.1?

-Boris


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Niall Ross
Sent: Monday, May 14, 2012 4:05 PM
To: Steve Whitson
Cc: [hidden email]
Subject: Re: [vwnc] postgresql version 9.1 problem

Dear Steve,
Dan D'Eramo located the cause: PostgreSQL 9.1's fix

"Change the default value of standard_conforming_strings to on (Robert
Haas): by default, backslashes are now ordinary characters in string
literals, not escape characters. This change removes a long-standing
incompatibility with the SQL standard. escape_string_warning has
produced warnings about this usage for years. E" strings are the proper
way to embed backslash escapes in strings and are unaffected by this
change. WARNING This change can break applications that are not
expecting it and do their own string escaping according to the old
rules. ..."

(From a quick glance) the method
PostgreSQLEXDIStringValue>>stringFromObject does exactly this in-app
behaviour in our Postgres (I should say Bruce Badger's Postgres).

Dan is working on a resolution for our existing releases. A fix will
also go into 7.9.1 and 7.10 (almost certainly far too late for 7.9 at
this point - the resolution will therefore apply to 7.9 as well).

Thanks for info
Niall Ross

> I failed to mention that I do have the "bytea_output = 'escape'" in my

> postgresql.conf file (the fix for 9.0).
>
> On 5/14/2012 10:33 AM, Steve Whitson wrote:
>
>> Hi,
>>
>> I've come across a problem when using postgresql version 9.1 (using
>> visualworks 7.7.1)
>>
>> We have a couple methods named _\\_
>>
>> In postgresql versions 7.x - 9.0 this has been working just fine
>> (replicates, publishes, and loads, all ok)... now in 9.1 the method
>> name becomes _\\\\_ when replicated or published (not something we
>> did... something that postgresql 9.1 did is what I'd presume). This
>> is not something we want to have happen.
>>
>> If I attempt to load the package that contains the _\\\\_ method then

>> the _\\_ method is removed from my image (as expected) but _\\\\_ is
>> not loaded.
>>
>> Has anyone else seen anything like this? Ideas?
>>
>> Thanks much,
>> -Steve
>>
>
>
>-----------------------------------------------------------------------
-
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Niall Ross
In reply to this post by Maarten Mostert
Dear Marten,

 >> WARNING This change can break applications that are not
 >> expecting it and do their own string escaping according to the
 >> old rules. ..."

>Are we talking all postgres or Store only here ?
>  
>
IIUC, VW's Postgres EXDI layer is where the old-style fixing of the \s
occurs (in PostgreSQLEXDIStringValue>>stringFromObject), therefore
whatever passes through that layer (i.e. everything, for all practical
purposes) will experience the effect if it uses the current
implementation to connect to a Postgres 9.1 or later installation that
itself does the correction.  So no, it is not just Store.

             Yours faithfully
                   Niall Ross

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Steve Whitson
In reply to this post by Maarten Mostert
Hi Niall,

Store with a postgresql backend.  As noted (or will be soon) I did receive a fix that works based on some initial testing (large set of bundles/packages dumped in and reconciled against).

Thanks,
    -Steve


On 5/15/2012 2:06 AM, [hidden email] wrote:

Niall,  Steve,

 

Are we talking all postgres or Store only here ?

 

Thanks,

 

Maarten,

 

-----Original Message-----
From: "Niall Ross" [hidden email]
Sent: Monday, 14 May, 2012 22:04
To: "Steve Whitson" [hidden email]
Cc: [hidden email] [hidden email]
Subject: Re: [vwnc] postgresql version 9.1 problem

Dear Steve,
Dan D'Eramo located the cause: PostgreSQL 9.1's fix

"Change the default value of standard_conforming_strings to on (Robert
Haas): by default, backslashes are now ordinary characters in string
literals, not escape characters. This change removes a long-standing
incompatibility with the SQL standard. escape_string_warning has
produced warnings about this usage for years. E” strings are the proper
way to embed backslash escapes in strings and are unaffected by this
change. WARNING This change can break applications that are not
expecting it and do their own string escaping according to the old
rules. ..."

(From a quick glance) the method
PostgreSQLEXDIStringValue>>stringFromObject does exactly this in-app
behaviour in our Postgres (I should say Bruce Badger's Postgres).

Dan is working on a resolution for our existing releases. A fix will
also go into 7.9.1 and 7.10 (almost certainly far too late for 7.9 at
this point - the resolution will therefore apply to 7.9 as well).

Thanks for info
Niall Ross

> I failed to mention that I do have the "bytea_output = 'escape'" in my
> postgresql.conf file (the fix for 9.0).
>
> On 5/14/2012 10:33 AM, Steve Whitson wrote:
>
>> Hi,
>>
>> I've come across a problem when using postgresql version 9.1 (using
>> visualworks 7.7.1)
>>
>> We have a couple methods named _\\_
>>
>> In postgresql versions 7.x - 9.0 this has been working just fine
>> (replicates, publishes, and loads, all ok)... now in 9.1 the method
>> name becomes _\\\\_ when replicated or published (not something we
>> did... something that postgresql 9.1 did is what I'd presume). This
>> is not something we want to have happen.
>>
>> If I attempt to load the package that contains the _\\\\_ method then
>> the _\\_ method is removed from my image (as expected) but _\\\\_ is
>> not loaded.
>>
>> Has anyone else seen anything like this? Ideas?
>>
>> Thanks much,
>> -Steve
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: postgresql version 9.1 problem

Steve Whitson
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Yes, what Boris states is exactly what I have and it works as expected
based on my initial trials...

Thanks much!

On 5/15/2012 6:13 AM, Boris Popov, DeepCove Labs wrote:

> Niall,
>
> Supposedly, the short term fix is to then set both,
>
> standard_conforming_strings = off
> bytea_output = 'escape'
>
> in postgresql.conf to get Store working in 9.1?
>
> -Boris
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Niall Ross
> Sent: Monday, May 14, 2012 4:05 PM
> To: Steve Whitson
> Cc: [hidden email]
> Subject: Re: [vwnc] postgresql version 9.1 problem
>
> Dear Steve,
> Dan D'Eramo located the cause: PostgreSQL 9.1's fix
>
> "Change the default value of standard_conforming_strings to on (Robert
> Haas): by default, backslashes are now ordinary characters in string
> literals, not escape characters. This change removes a long-standing
> incompatibility with the SQL standard. escape_string_warning has
> produced warnings about this usage for years. E" strings are the proper
> way to embed backslash escapes in strings and are unaffected by this
> change. WARNING This change can break applications that are not
> expecting it and do their own string escaping according to the old
> rules. ..."
>
> (From a quick glance) the method
> PostgreSQLEXDIStringValue>>stringFromObject does exactly this in-app
> behaviour in our Postgres (I should say Bruce Badger's Postgres).
>
> Dan is working on a resolution for our existing releases. A fix will
> also go into 7.9.1 and 7.10 (almost certainly far too late for 7.9 at
> this point - the resolution will therefore apply to 7.9 as well).
>
> Thanks for info
> Niall Ross
>
>> I failed to mention that I do have the "bytea_output = 'escape'" in my
>> postgresql.conf file (the fix for 9.0).
>>
>> On 5/14/2012 10:33 AM, Steve Whitson wrote:
>>
>>> Hi,
>>>
>>> I've come across a problem when using postgresql version 9.1 (using
>>> visualworks 7.7.1)
>>>
>>> We have a couple methods named _\\_
>>>
>>> In postgresql versions 7.x - 9.0 this has been working just fine
>>> (replicates, publishes, and loads, all ok)... now in 9.1 the method
>>> name becomes _\\\\_ when replicated or published (not something we
>>> did... something that postgresql 9.1 did is what I'd presume). This
>>> is not something we want to have happen.
>>>
>>> If I attempt to load the package that contains the _\\\\_ method then
>>> the _\\_ method is removed from my image (as expected) but _\\\\_ is
>>> not loaded.
>>>
>>> Has anyone else seen anything like this? Ideas?
>>>
>>> Thanks much,
>>> -Steve
>>>
>>
>> -----------------------------------------------------------------------
> -
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

Conrad Taylor
In reply to this post by Niall Ross
Hi, is there built in support for string interpolation within VW 7.8.1?  I was just wondering about the following syntax:

#(  '$(VISUALWORKS)/contributed/AutoComplete.pcl' ) do: [:each |  ... ].

--

Think different and code well,

-Conrad



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

Boris Popov, DeepCove Labs (SNN)

Is this what you mean?

 

'$(SYSTEMROOT)\system32' asLogicalFileSpecification asFilename -> a NTFSFilename('c:\Windows\system32')

 

See class comment for PortableFilename.

 

-Boris

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Conrad Taylor
Sent: Wednesday, May 16, 2012 8:44 PM
To: [hidden email]
Subject: Re: [vwnc] String interpolation syntax?

 

Hi, is there built in support for string interpolation within VW 7.8.1?  I was just wondering about the following syntax:

 

#(  '$(VISUALWORKS)/contributed/AutoComplete.pcl' ) do: [:each |  ... ].

 

--

 

Think different and code well,

 

-Conrad

 

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

Conrad Taylor
On Wed, May 16, 2012 at 5:49 PM, Boris Popov, DeepCove Labs <[hidden email]> wrote:

Is this what you mean?


I was this about something more general like the following:

city := 'Chicago'.
startYear := 1995.
endYear :=  2000.

question := 'Do you live in $(city) between the years of $(startYear) and $(endYear) ?'

 

'$(SYSTEMROOT)\system32' asLogicalFileSpecification asFilename -> a NTFSFilename('c:\Windows\system32')

 

See class comment for PortableFilename.

 

-Boris

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Conrad Taylor
Sent: Wednesday, May 16, 2012 8:44 PM
To: [hidden email]
Subject: Re: [vwnc] String interpolation syntax?

 

Hi, is there built in support for string interpolation within VW 7.8.1?  I was just wondering about the following syntax:

 

#(  '$(VISUALWORKS)/contributed/AutoComplete.pcl' ) do: [:each |  ... ].

 

--

 

Think different and code well,

 

-Conrad

 

 




--

Think different and code well,

-Conrad



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

Boris Popov, DeepCove Labs (SNN)

city := 'Chicago'.

start := 1995.

end := 2000.

'Did you live in <1s> between the years of <2p> and <3p>?'

                expandMacrosWith: city

                with: start

                with: end.

 

'Did you live in Chicago between the years of 1995 and 2000?'

 

See class comment of StringParameterSubstitution for syntax details.

 

HTH,

 

-Boris

 

From: Conrad Taylor [mailto:[hidden email]]
Sent: Wednesday, May 16, 2012 9:32 PM
To: Boris Popov, DeepCove Labs
Cc: [hidden email]
Subject: Re: [vwnc] String interpolation syntax?

 

On Wed, May 16, 2012 at 5:49 PM, Boris Popov, DeepCove Labs <[hidden email]> wrote:

Is this what you mean?

 

I was this about something more general like the following:

 

city := 'Chicago'.

startYear := 1995.

endYear :=  2000.

 

question := 'Do you live in $(city) between the years of $(startYear) and $(endYear) ?'

 

 

'$(SYSTEMROOT)\system32' asLogicalFileSpecification asFilename -> a NTFSFilename('c:\Windows\system32')

 

See class comment for PortableFilename.

 

-Boris

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Conrad Taylor
Sent: Wednesday, May 16, 2012 8:44 PM
To: [hidden email]
Subject: Re: [vwnc] String interpolation syntax?

 

Hi, is there built in support for string interpolation within VW 7.8.1?  I was just wondering about the following syntax:

 

#(  '$(VISUALWORKS)/contributed/AutoComplete.pcl' ) do: [:each |  ... ].

 

--

 

Think different and code well,

 

-Conrad

 

 



 

--

 

Think different and code well,

 

-Conrad

 

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

johnhwoods
In reply to this post by Conrad Taylor
Conrad,

You can do this with String Param substitution, but can I suggest a more OO approach?  

q := PreviousCityQuestion new.
q city: 'Chicago';
   startYear: 1990;
   endYear: 1995.
q ask.

or even get more adventurous with a more general Question class and readable method signatures.

q := Question
          didYouLiveIn: 'Chicago'
          between: 1990
          and: 1995

Implementation of classes left as an exercise for the reader.  Question could have a parameter dictionary, for instance.  Loads of potential!

The upshot is, if you think about what you are doing, you are either adding functionality (question asking) to state (e.g. a set of instance vars) or you are adding state (start year, end year, city) to a function (e.g. String Creation).  In my opinion, when you are doing one of those things (adding state or function) you are doing everything that you would do by creating a (possibly sub)class, so why not create one?


Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

Boris Popov, DeepCove Labs (SNN)
I wouldn't recommend this as general solution for all cases as it would
be an overkill for many things like logging, UI labels, error messages
etcetera where you're going a very short distance from a string to a
string.

-Boris


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of johnhwoods
Sent: Thursday, May 17, 2012 10:52 AM
To: [hidden email]
Subject: Re: [vwnc] String interpolation syntax?

Conrad,

You can do this with String Param substitution, but can I suggest a more
OO approach?  

q := PreviousCityQuestion new.
q city: 'Chicago';
   startYear: 1990;
   endYear: 1995.
q ask.

or even get more adventurous with a more general Question class and
readable method signatures.

q := Question
          didYouLiveIn: 'Chicago'
          between: 1990
          and: 1995

Implementation of classes left as an exercise for the reader.  Question
could have a parameter dictionary, for instance.  Loads of potential!

The upshot is, if you think about what you are doing, you are either
adding functionality (question asking) to state (e.g. a set of instance
vars) or you are adding state (start year, end year, city) to a function
(e.g. String Creation).  In my opinion, when you are doing one of those
things (adding state or function) you are doing everything that you
would do by creating a (possibly sub)class, so why not create one?




--
View this message in context:
http://forum.world.st/postgresql-version-9-1-problem-tp4630154p4630659.h
tml
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: String interpolation syntax?

johnhwoods
Hi Boris,

I very respectfully disagree.  By 'overkill' I assume you mean that the costs would outweigh the benefits.  But I think the costs of creating a new class, either in terms of intellectual effort, keystrokes, or performance costs in operation, are negligible.  The benefits could be significant - code readability (which I would argue is almost always the most important thing), extensibility or adaptability (e.g. for internationalisation).

You mention logging as an example, but to me that would cry out for a new class.  Consider:
   Transcript show: Time now printString; tab; show: ' In method foobar:'; tab ; show: 'Entering the loop'
versus
   Logger out: 'Entering the loop'
where the Logger itself chooses where to display (e.g. Transcript) or store (e.g. File) the output (and could do both), adds its own timestamp, and queries the callstack to identify the method automatically.  By rewriting 'out:' to '^self' I can turn off all logging immediately, even whilst running.

I always struggle to understand what appears to me to be reticence to create new classes.  To me OO is all about not having to predict how you will need to extend or adapt things, because by following the paradigm it becomes automatically easier.  If it were easy to predict what would need to be changed in future, the structured paradigm would be just as useful as OO.

Even if I only had two questions of the kind Conrad has, I would probably still create a class to do it.  I would argue that it's almost the same amount of effort - and indeed source code - for something that is much more readable, much more debuggable, and should unforeseen circumstances arise, very much more flexible.