strong/weak typing and pointers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl Banks

    #76
    Re: Summary: strong/weak typing and pointers

    Steven Bethard <steven.bethard @gmail.com> wrote in message news:<mailman.5 875.1099517778. 5135.python-list@python.org >...[color=blue]
    > Gabriel Zachmann writes:[color=green]
    > >
    > > would sort of a summary of this thread be of any help?[/color]
    >
    > Here's a first stab at one:
    >
    > In summary, there are basically three interpretations of "weak-typing" discussed
    > in this thread:[/color]
    [snip]


    It seems to me that "weak/strong" description of typing is too
    overloaded to be very specific. Everyone seems to mean something
    different by "weak" typing. Some mean the ability to reinterpret
    bits. Some mean ability to do a lot of implicit conversions. Some
    (not anyone here, of course) mean dynamic typing. And I'm sure some
    mean something else.

    I recommend we stop using "weak/strong typing" as a technical term,
    and leave it to be a meaningless buzzword for the ignorant peasantry.

    Instead, we should define several other scales, with very specific
    names. I'll make some suggestions. One thing to keep in mind is that
    these are, in fact, spectra; many languages will not be one extreme or
    the other.

    Static/dynamic typing we already know about.

    About the ability to reintepret bits: it seems that the essence of
    this is that bits can be reinterpreted under different
    _circumstances_ . So a good, specific name for this distinction might
    be "manifest/circumstantial typing". The words are a bit long, yes,
    but off-hand I can't think of any shorter words that are specific
    enough. Words like "loose", "flexible", etc. could mean a lot of
    things, just as "weak" does. "Circumstantial " is somewhat more
    specific, but still could mean a few different things. Maybe it
    should just be "bit-reinterpretable "? "Manifest" might not be a good
    word, either, since it's kind of discrete in meaning. Can something
    be "less manifest"? Suggestions welcome, of course.

    About the cramming of many different representations into a single
    type, abused to the extreme by Perl: we might call this "overloaded
    typing". Two things I don't like about it: first, it has a slightly
    negative connotation (I'd prefer that terminology be neutral, which is
    another reason I didn't like "strong/weak"), and second, it's not
    clear what the opposite aspect should be called. Perhaps we could
    coin some terms such as "polybasic/oligobasic/monobasic". (I would
    have suggested "polymorphi c" but it was taken :).

    About the implicit type conversions: this I find the hardest to name.
    The best I can come up with is "coercive/restrictive". I think we
    need a better suggestion. I really think this label only make sense
    for predefined operations, and maybe some functions. If I write a
    function "def a(b): b=int(b); ...", is that coercive in the same
    spirit as "a" + 1 in Java? I would say not. In fact, I would say
    this isn't even a property of the typing. We should probably say that
    a language is a "type-coercive language" rather than that it has
    "coercive typing". Actually, we should say it's something else, cause
    I just don't like the term coercive. Maybe "type-general" vs
    "type-specific"? Seems to vague. "Type-tolerant" vs "type-picky"? I
    don't know. Suggestions?

    So, to summarize, I recommend we do away with "strong/weak." We
    replace it with four spectra, with some suggested names:

    static/dynamic
    manifest/circumstantial
    monobasic/polybasic
    coercive/restrictive*


    --
    CARL BANKS

    Comment

    • Gabriel Zachmann

      #77
      Re: Summary: strong/weak typing and pointers


      I had already compiled a little file of clips plus the two definitions I
      had seen so far.

      But your summary is better, so it goes into my summary file, too. ;-)


      Cheers,
      gabriel.

      --
      /-------------------------------------------------------------------------\
      | There are works which wait, |
      | and which one does not understand for a long time; [...] |
      | for the question often arrives a terribly long time after the answer. |
      | (Oscar Wilde) |
      +-------------------------------------------------------------------------+
      | zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
      \-------------------------------------------------------------------------/

      Comment

      • Dave Benjamin

        #78
        Re: strong/weak typing and pointers

        In article <cmegqg$ea2$03$ 1@news.t-online.com>, Diez B. Roggisch wrote:[color=blue]
        > Steven Bethard wrote:
        >[color=green]
        >> Michael Hobbs <mike <at> hobbshouse.org> writes:[color=darkred]
        >>>
        >>> One word: union
        >>>[/color]
        >>
        >> Interestingly, unions can be well-defined even in a strongly-typed
        >> language, e.g. OCaml:
        >>
        >> # type int_or_list = Int of int | List of int list;;
        >> type int_or_list = Int of int | List of int list
        >> # Int 1;;
        >> - : int_or_list = Int 1
        >> # List [1; 2];;
        >> - : int_or_list = List [1; 2][/color]
        >
        > Unions in functional languages are also known as direct sums of types (as
        > opposed to products, which form tuples). And trying to access a union that
        > holds an int as list will yield an error - runtime, most probably. So there
        > is no way of reinterpreting an int as list, which still satisfies the
        > paragdigms of a strong typed language.[/color]

        Just FYI:

        In OCaml, the error will be at compile time, and the compiler will warn you
        if you do not deal with all possible cases for a given union type.

        --
        .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.
        "talking about music is like dancing about architecture."

        Comment

        • Stefan Axelsson

          #79
          Re: Summary: strong/weak typing and pointers

          Carl Banks wrote:
          [color=blue]
          > It seems to me that "weak/strong" description of typing is too
          > overloaded to be very specific. Everyone seems to mean something
          > different by "weak" typing.[/color]
          [...][color=blue]
          > I recommend we stop using "weak/strong typing" as a technical term,
          > and leave it to be a meaningless buzzword for the ignorant peasantry.[/color]

          You're not alone. Wikipedia lists 8 (!) different meanings for the term
          "Strong typing" (http://en.wikipedia.org/wiki/Strong_typing):

          I quote:
          -----------------------------------------------------------------------
          Note that some of these definitions are contradictory, while others are
          merely orthogonal.

          Because there is no generally-agreed meaning for the phrase
          "strongly-typed language", it is possible to find authoritative
          statements that many languages both are and are not strongly-typed. For
          example, under definitions 1, 2, 3, and 8, the C language is strongly
          typed; under 4, 5, and 6 it is weakly typed. Accordingly, it is easy to
          find people who will claim that C is a "strongly-typed language" and
          others who will claim that it is a "weakly-typed language".

          Programming language expert Benjamin C. Pierce has said:

          I spent a few weeks . . . trying to sort out the terminology of
          "strongly typed," "statically typed," "safe," etc., and found it
          amazingly difficult. . . . The usage of these terms is so various as to
          render them almost useless.
          -----------------------------------------------------------------------

          I'd say that this horse is well and truly dead...

          Stefan,
          --
          Stefan Axelsson (email at http://www.cs.chalmers.se/~sax)

          Comment

          • Greg Ewing

            #80
            Re: Summary: strong/weak typing and pointers

            Carl Banks wrote:[color=blue]
            > I recommend we stop using "weak/strong typing" as a technical term,
            > and leave it to be a meaningless buzzword for the ignorant peasantry.[/color]

            How about:

            solid typing -- sharp boundaries between types, few
            automatic coercions

            fluid typing -- lots of automatic coercions

            (Don't ask me what "gaseous typing" might mean...)

            --
            Greg Ewing, Computer Science Dept,
            University of Canterbury,
            Christchurch, New Zealand


            Comment

            • Gabriel Zachmann

              #81
              Re: Summary: strong/weak typing and pointers


              I have tried to summarize this thread and created a new article on the
              Python Wiki at

              The official home of the Python Programming Language


              HTH,
              Gabriel.

              --
              /-------------------------------------------------------------------------\
              | There are works which wait, |
              | and which one does not understand for a long time; [...] |
              | for the question often arrives a terribly long time after the answer. |
              | (Oscar Wilde) |
              +-------------------------------------------------------------------------+
              | zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
              \-------------------------------------------------------------------------/

              Comment

              • Carl Banks

                #82
                Re: Summary: strong/weak typing and pointers

                Greg Ewing <greg@cosc.cant erbury.ac.nz> wrote in message news:<2v82u3F2d htcpU1@uni-berlin.de>...[color=blue]
                > Carl Banks wrote:[color=green]
                > > I recommend we stop using "weak/strong typing" as a technical term,
                > > and leave it to be a meaningless buzzword for the ignorant peasantry.[/color]
                >
                > How about:
                >
                > solid typing -- sharp boundaries between types, few
                > automatic coercions
                >
                > fluid typing -- lots of automatic coercions[/color]

                Very nice. I bow to your metaphorical creativity.

                [color=blue]
                > (Don't ask me what "gaseous typing" might mean...)[/color]

                Compiler builds a directed graphs of type conversions and always
                chooses the shortest path.


                actually-gases-are-fluids-too-ly yr's,
                --
                CARL BANKS

                Comment

                • Martin Maney

                  #83
                  Re: Summary: strong/weak typing and pointers

                  Greg Ewing <greg@cosc.cant erbury.ac.nz> wrote:[color=blue]
                  > solid typing -- sharp boundaries between types, few
                  > automatic coercions[/color]
                  [color=blue]
                  > fluid typing -- lots of automatic coercions[/color]
                  [color=blue]
                  > (Don't ask me what "gaseous typing" might mean...)[/color]

                  Surely that would be typing by context, no?

                  --
                  Among the greater ironies of the computer age is the fact that
                  information is cheap and accessible, and so it is no longer very valuable.
                  What is valuable is what one does with it.
                  And human imagination cannot be mechanized. -- the New York Times

                  Comment

                  • JCM

                    #84
                    Re: Summary: strong/weak typing and pointers

                    Greg Ewing <greg@cosc.cant erbury.ac.nz> wrote:[color=blue]
                    > Carl Banks wrote:[color=green]
                    >> I recommend we stop using "weak/strong typing" as a technical term,
                    >> and leave it to be a meaningless buzzword for the ignorant peasantry.[/color][/color]
                    [color=blue]
                    > How about:[/color]
                    [color=blue]
                    > solid typing -- sharp boundaries between types, few
                    > automatic coercions[/color]
                    [color=blue]
                    > fluid typing -- lots of automatic coercions[/color]
                    [color=blue]
                    > (Don't ask me what "gaseous typing" might mean...)[/color]

                    I think both liquids and gases are considered fluids. Liquid Typing
                    and Gaseous Typing would be sub-categories.

                    Comment

                    • Greg Ewing

                      #85
                      Re: Summary: strong/weak typing and pointers

                      JCM wrote:[color=blue]
                      > I think both liquids and gases are considered fluids. Liquid Typing
                      > and Gaseous Typing would be sub-categories.[/color]

                      Hmmm. So maybe with liquid typing, your data sloshes
                      around in the bottom of your address space, whereas
                      with gaseous typing, it expands to fill all available
                      memory...

                      --
                      Greg Ewing, Computer Science Dept,
                      University of Canterbury,
                      Christchurch, New Zealand


                      Comment

                      • Tim Hoffman

                        #86
                        Re: Summary: strong/weak typing and pointers

                        Greg Ewing wrote:[color=blue]
                        > JCM wrote:
                        >[color=green]
                        >> I think both liquids and gases are considered fluids. Liquid Typing
                        >> and Gaseous Typing would be sub-categories.[/color]
                        >
                        >
                        > Hmmm. So maybe with liquid typing, your data sloshes
                        > around in the bottom of your address space, whereas
                        > with gaseous typing, it expands to fill all available
                        > memory...
                        >[/color]
                        Continuing in this theme, does this mean that phase transition (between
                        solids and fluids ) typing, is typing of an indeterminate nature ;-)

                        Oops now that we are on the slippery slope of metaphors ;-) do we class
                        super cooled liquid types as ones that can be co-oerced but just take a
                        very long time ;-)

                        Tim



                        Comment

                        • Michael Hobbs

                          #87
                          Re: Summary: strong/weak typing and pointers

                          JCM <joshway_withou t_spam@myway.co m> wrote:[color=blue]
                          > Greg Ewing <greg@cosc.cant erbury.ac.nz> wrote:[color=green]
                          >> Carl Banks wrote:[color=darkred]
                          >>> I recommend we stop using "weak/strong typing" as a technical term,
                          >>> and leave it to be a meaningless buzzword for the ignorant peasantry.[/color][/color]
                          >[color=green]
                          >> How about:[/color]
                          >[color=green]
                          >> solid typing -- sharp boundaries between types, few
                          >> automatic coercions[/color]
                          >[color=green]
                          >> fluid typing -- lots of automatic coercions[/color]
                          >[color=green]
                          >> (Don't ask me what "gaseous typing" might mean...)[/color]
                          >
                          > I think both liquids and gases are considered fluids. Liquid Typing
                          > and Gaseous Typing would be sub-categories.[/color]

                          I was thinking that "rigid" would be the antonym of "fluid".

                          I'm not sure which would be the most accurate juxtaposition:
                          solid vs. liquid
                          or
                          rigid vs. fluid
                          or
                          gaseous vs. plasmatic
                          or
                          sticky vs. solvent
                          I could go on...

                          - Mike

                          Comment

                          • Andrew Dalke

                            #88
                            Re: Summary: strong/weak typing and pointers

                            Tim Hoffman wrote:[color=blue]
                            > Oops now that we are on the slippery slope of metaphors ;-) do we class
                            > super cooled liquid types as ones that can be co-oerced but just take a
                            > very long time ;-)[/color]

                            Or perhaps since supercooled fluids have all particles in the
                            lowest quantum state, the metaphor is that everything gets treated
                            as the root Object type?

                            Andrew
                            dalke@dalkescie ntific.com

                            Comment

                            • Carl Banks

                              #89
                              Re: Summary: strong/weak typing and pointers

                              mike@hobbshouse .org (Michael Hobbs) wrote in message news:<10p1ud2ju qlkb7c@corp.sup ernews.com>...[color=blue]
                              > JCM <joshway_withou t_spam@myway.co m> wrote:[color=green]
                              > > I think both liquids and gases are considered fluids. Liquid Typing
                              > > and Gaseous Typing would be sub-categories.[/color]
                              >
                              > I was thinking that "rigid" would be the antonym of "fluid".[/color]

                              You are correct, of course. However, I don't like "rigid" as a term
                              to describe typing, for a simple reason: it's not specific enough.

                              Unlike solid, rigid can easily refer not only to substances, but also
                              to stances, or laws, or hierarchies, or guidelines, etc. Rigid is
                              sometimes used as a synonym for strong (hopefully not by engineers).
                              Because it has a very general meaning, "rigid typing" could be
                              construed as meaning a lot of different things.

                              OTOH, solid tends to refer specifically to substances. It is the
                              metaphor to substances which, IMO, makes solid a good term for this
                              aspect of typing. Solid substances don't deform under pressure;
                              likewise, solid typing systems to convert the types under pressure.

                              If someone hears the term "rigid typing", they could conceivably take
                              it to mean "static typing" or (my definition) "manifest typing". But
                              if they hear "solid typing", then it's a stretch to take it to mean
                              "manifest typing" and a bigger stretch to take it to mean "static
                              typing".

                              On the opposite end, I think I actually would prefer "liquid" to
                              "fluid". Fluid would be ok; unlike with rigid, there are no fluid
                              stances or fluid laws, although there are fluid guidelines. Fluid
                              isn't as general in meaning as rigid is. However, the word liquid
                              definitely stresses the metaphor with substances a lot better then the
                              word fluid does.


                              --
                              CARL BANKS

                              Comment

                              • Jeff Shannon

                                #90
                                Re: Summary: strong/weak typing and pointers

                                Carl Banks wrote:
                                [color=blue]
                                >mike@hobbshous e.org (Michael Hobbs) wrote in message news:<10p1ud2ju qlkb7c@corp.sup ernews.com>...
                                >
                                >[color=green]
                                >>I was thinking that "rigid" would be the antonym of "fluid".
                                >>
                                >>[/color]
                                >
                                >You are correct, of course. However, I don't like "rigid" as a term
                                >to describe typing, for a simple reason: it's not specific enough.
                                >
                                >Unlike solid, rigid can easily refer not only to substances, but also
                                >to stances, or laws, or hierarchies, or guidelines, etc. [...]
                                >
                                >On the opposite end, I think I actually would prefer "liquid" to
                                >"fluid". Fluid would be ok; unlike with rigid, there are no fluid
                                >stances or fluid laws, although there are fluid guidelines. Fluid
                                >isn't as general in meaning as rigid is. However, the word liquid
                                >definitely stresses the metaphor with substances a lot better then the
                                >word fluid does.
                                >
                                >[/color]

                                On the other hand, I personally think that "rigid/fluid" make a better
                                metaphor specifically *because* they are not tied so much to physical
                                properties -- they are terms that have already been generalized as
                                metaphor in the much same way as is intended here. The parallel with
                                rigid stances, rigid hierarchies, etc, is an appropriate one -- in all
                                such cases, we're talking about something that resists attempts to
                                change its nature and/or form. Similarly, "fluid" connotes "easily
                                conforming to its environment", an apt description of the behavior of
                                objects in a language full of automatic conversions/coercions. At least
                                to me, the most obvious interpretation of both terms is the situation
                                we're discussing here

                                Jeff Shannon
                                Technician/Programmer
                                Credit International

                                Comment

                                Working...