Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Typing

Name: Anonymous 2009-10-22 15:39

Many languages such as Java and C use what is known as strong or static variable typing. This means that when you declare a variable in your application code you must define the variable type.

Name: Anonymous 2009-10-22 15:40

strong or static variable typing.
I will not be trolled so easily, Anonymous

Name: Anonymous 2009-10-22 15:53

Name: Anonymous 2009-10-22 16:13

HURR STRONG TYPING = STATIC TYPING

HURR C HAS STRONG TYPING

Name: ITT: Feeding the Troll 2009-10-22 16:21

>>3
The mistake >>1-chan made was in writing "strong or static typing" as if they were the same thing.

Strong typing is where you can't write a Fixnum and read it back as a String. In C, you can write an int and read it back as a char * with minimal hassle, making C a weakly typed language.

Static typing is where names (variables, functions, etc.) have types.

Name: Anonymous 2009-10-22 17:29

>>5
And just because a variable has a type doesn't mean you need to declare it.

Name: Anonymous 2009-10-22 18:10

STATICALLY TYPE MY ANUS, por favor

Name: Anonymous 2009-10-22 18:16

>>7
anus Myanus = new AnusFactory.createAnus()

Name: Anonymous 2009-10-22 20:06

>>8
thx

Name: Anonymous 2009-10-22 20:36

int hi = new int(1)

Name: Anonymous 2009-10-22 20:53

>>10
Leave this place and do not return.

Name: Anonymous 2009-10-22 20:56

>>11
chill down bro
fibs = fibs -1 + fibs - 2 okay?

Name: Anonymous 2009-10-22 20:58

count = count + 1

Name: Anonymous 2009-10-22 23:29

Actionscript has weak type associations and declares an untyped.*
What's your point?

Name: Anonymous 2009-10-22 23:30

>>12
bro, bro, fight the powah

Name: Anonymous 2009-10-22 23:55

>>6
This mistake >>5-chan made was interpreting >>1 and >>3 as two different people unaware of the facts at hand.

Name: Anonymous 2009-10-23 11:18

Dynamic typing was here. Static typing is made of failure. (I recently came upon a case where a certain control had two completely similar interfaces for web and client deployment, however, those interfaces resided in different namespaces, so I ended up copypasting half the methods just to change the namespace. This made me rage so hard.)

Name: Anonymous 2009-10-23 14:13

>>17
See, it helps you avoid failures because you copypaste all your perfect code! Now that's reuse!

Name: Anonymous 2009-10-23 14:29

Pure type systems are awesome, though. Too bad no language has them.

Name: Anonymous 2009-10-23 17:32

>>18
I lol'd so hard

Name: Anonymous 2009-10-26 5:07

>>18
Why yes, thank you for pouring that sarcasm all over me, I never knew what ill I had done!

Oh, yeah, still looking for alternate solutions, by the way.

Name: Anonymous 2009-10-26 5:10

i can type at about 70WPM

Name: Anonymous 2009-10-26 10:01

If you need to type at > 30WPM when programming, you're doing it wrong.

Name: Anonymous 2009-10-26 10:05

>>23
What about live coding music?

Name: Anonymous 2009-10-26 10:05

Does it exist a strong typed LISP? (I'm  strongly interested)

Name: Anonymous 2009-10-26 10:08

>>25
The Lisp family of languages are all "strongly typed" in the sense that typing errors are prevented at runtime. Some Lisp dialects like Common Lisp do support various forms of type declarations[3] and some compilers (CMUCL[4] and related) are using these declarations together with type inference to enable various optimizations and also limited forms of compile time type checks.

http://en.wikipedia.org/wiki/Strong_typing

Name: Anonymous 2009-10-26 10:40

>>25
Most Lisp dialects are dynamically typed, which means that data itself is typed, but variables/symbols can hold any kind of data of any type. Type declarations are supported, but they're just advice for the compiler. However, if you use the wrong operation on some data, you will get a condition/error signaled. Dynamic typing does not mean it's unsafe, just that typing errors will be gracefully signaled at runtime (which could be handled dynamically). Smarter compilers may detect some typing errors, however languages like Common Lisp have operations capable of working on very generic types, which makes type checking much harder than one would think.

If you would like something more similar to Haskell's or ML's type system, you might want to look into Qi, which is a functional language which has support for optional typechecking.
There's also a Lisp-like extension to GHC(Haskell compiler) called Liskell.

Name: Anonymous 2009-10-26 10:43

And I've forgot to mention that if you would like to declare types and have the compiler check their type for you, you can use the CHECK-TYPE macro which just expands to:

 (check-type place typespec)
 ==  (assert (typep place 'typespec) (place)
            'type-error :datum place :expected-type 'typespec)

Name: Anonymous 2009-10-26 11:09

>>28
that's not true. check-type also establishes a store-value restart, not just expands to the code you provided.

Name: Anonymous 2009-10-26 11:40

>>29
I've copied that example expansion straight out of CLHS, however it seems you are right, the CLHS says that it estabilishes that restart, and looking at the implementation of CHECK-TYPE in SBCL, this is what they use signal the error and establish the restart:

(defun check-type-error (place place-value type type-string)
  (let ((condition
         (make-condition
          'simple-type-error
          :datum place-value
          :expected-type type
          :format-control
          "The value of ~S is ~S, which is not ~:[of type ~S~;~:*~A~]."
          :format-arguments (list place place-value type-string type))))
    (restart-case (error condition)
      (store-value (value)
        :report (lambda (stream)
                  (format stream "Supply a new value for ~S." place))
        :interactive read-evaluated-form
        value))))

An actual CHECK-TYPE instance would expand to a DO loop which calls that function I pasted until the type is correct (or the code exits non-locally).

Name: Anonymous 2009-10-26 14:03

>>30 that's not all, no mention of setting the place to the provided value.

Name: Anonymous 2009-10-27 13:32

>>30
This is power. The language type-checks itself. Sepples faggots can't even get a decidable grammar, and lisp has turtles all the way down.

Name: Anonymous 2010-11-28 8:03


Don't change these.
Name: Email:
Entire Thread Thread List