Loading ...
Sorry, an error occurred while loading the content.

Re: [eiffel-nice-library] Re: STRING 'make' - should its name be changed?

Expand Messages
  • James McKim
    I agree with Franck. We don t really know what the parameter on make is there for. The proof of this is that we can t write a postcondition that uses it. So
    Message 1 of 37 , Apr 20, 2001
    • 0 Attachment
      I agree with Franck. We don't really know what the parameter on 'make' is
      there for. The proof of this is that we can't write a postcondition that
      uses it. So users won't know what it's for either, except perhaps as part
      of vendor specific documentation. That said, we're probably stuck with it
      as the vendors and more importantly their customers all have code that
      uses it in this form.

      Best,
      -- Jim

      >
      >
      > >I must disagree with Mr. Parker. I believe that the routine called `make'
      > >for a class is the one that would be expected to be called most frequently.
      >
      > If this is the one with capacity, it is certainly not the one you will
      > use most frequently, you don't want to use such low level implementation
      > details every time you create a simple string.
      >
      > >call this procedure you have some idea what it is that you are going to put
      > >in there and
      >
      > Personally I never know what to put in those sizing paremeters. Due to
      > portability constraints, for me the "(0)" in STRING.make(0) has become part
      > of the name for STRING so at least I don't have that problem. I guess
      > this kind of parameters are mostly useful to people used to think in
      > assembler.
      >
      > >if you have a good idea about the size requirements the best thing to do is
      > >create a string of that size initially.
      >
      > There are many implementation details you can have an idea of but
      > the point of a high level language, especially Eiffel is that you do
      > not have to care about those details. Why give initial size and not
      > hints about the layout of objects, the polymorphic nature of routines,
      > whether an object is to be shared, the growth policy of dynamic data
      > structures, etc.
      >
      > The fact that the only creation procedure of make exposes such low level
      > details is a major defect of the existing string class, something newcomers
      > to the language have to hit far too soon. Keeping that name for the sake
      > of compatibility seems OK, now we have better alternatives, but it remains
      > a defect that a procedure that looks like the default has such assembler-level
      > semantics.
      >
      > --
      > Franck Arnaud ~ email: franck@...
      >
      >
      > ---------------------------
      >
      > http://www.eiffel-nice.org/
      >
      > --------------------------
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
      >
    • Simon Parker
      Good morning. ... As I said earlier, I would actually prefer to drop the argument: make -- Create an empty string However, if an argument is to be included I
      Message 37 of 37 , Apr 27, 2001
      • 0 Attachment
        Good morning.

        > 20 APRIL 2001 16:30 version:
        >
        > make (n: INTEGER)
        > -- Create empty string with suggested capacity 'n' characters
        > require
        > non_negative_suggested_capacity: n >= 0

        As I said earlier, I would actually prefer to drop the argument:

        make
        -- Create an empty string

        However, if an argument is to be included I suggest this text:

        make (capacity: INTEGER)
        -- Create an empty string
        -- 'capacity' is an implementation hint, whose effect is undefined
        require
        positive_capacity: capacity >= 0



        Regards,
        Simon

        Simon Parker +353 87 249 7859


        On Thursday, April 26, 2001 7:25 PM, Roger Browne [SMTP:egroups@...] wrote:
        > Ulrich Windl wrote:
        >
        > > > 20 APRIL 2001 16:30 version:
        > > >
        > > > make (n: INTEGER)
        > > > -- Create empty string with suggested capacity 'n' characters
        > > > require
        > > > non_negative_suggested_capacity: n >= 0
        > >
        > > Also add some length to `n' ;-) s/n/suggested_capacity/ will make
        > > things more clear IMHO
        >
        > Do you mean like this:
        > make (suggested_capacity: INTEGER)
        > -- Create empty string with suggested capacity
        > -- 'suggested_capacity' characters
        >
        > I find the double occurrence of 'suggested_capacity' in the header
        > comment makes it hard to read.
        >
        > But I do like the idea of making the signature self-documenting. Is there
        > a better header comment that could be used with Ulrich's suggested
        > signature?
        >
        > If anyone has suggestions, please post them soon. We now have the result
        > from the "keep or remove 'make'" poll, and it shows overwhelming support
        > for keeping 'make'. So I'd like to soon run the poll to refine the
        > specification of 'make'.
        >
        > Regards,
        > Roger
        > --
        > Roger Browne - roger@... - Everything Eiffel
        > 19 Eden Park Lancaster LA1 4SJ UK - Phone +44 1524 32428
        >
        >
        > ---------------------------
        >
        > http://www.eiffel-nice.org/
        >
        > --------------------------
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.