Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

MononcQc posted:

More languages with optional typing systems:

  • Smalltalk (Strongtalk)
  • Erlang (Dialyzer)
  • Racket
  • Clojure
  • Qi / Shen
  • Dylan
  • Modula-3 (allowed unsafe modules)
  • Python (I've seen some attempts at least)

Those are the ones I can remember off the top of my head. They vary from type hints to full type systems that can be disabled or enabled on demand.

link

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

MononcQc posted:

Optional typing systems :whatup:

a good post

tef
May 30, 2004

-> some l-system crap ->

Malcolm XML posted:

Technically dynamic languages have exactly one type ( haskell's data.dynamic allows you to do some neat things)

Well, no, this is not true, and the only people who say this have heads so broken they can't imagine otherwise. The difference is this: Types are carried by the value at runtime, and checked at runtime, rather than variables having types and this is checked at compile time. Some systems use structural type equivalence, some use nominative type equivalence. Some allow both.

Optional type checking is one of those things people don't seem to get. It's as if the TDD movement said 'you shouldn't be able to compile your code if your test doesn't pass', and work out the error from the conflicts, rather than being able to trace through the behaviour that did that.

tef
May 30, 2004

-> some l-system crap ->
ps wadler wrote a paper on threesomes with an without blame which talks about writing a type system for dynamic languages that allows runtime casts but preserves enough information to know where the issue came from and haskell lets you defer errors to runtime too. seriously.

Police Academy III
Nov 4, 2011
I'm not sure if I'd call clojure optionally typed since no actual type checking goes on. there's nothing to stop you from doing (def ^int an-int "totally not an int") for example.

e: but seriously optional typing is really the most obvious way to get the best of both worlds and i wish more languages supported it. also actionscript is optionally typed, hilariously enough.

Police Academy III fucked around with this message at 01:29 on Mar 5, 2013

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Shaggar posted:

we're using dts on 2000 and barely suits our needs now. ssis has the potential to fix a lot of problems we have w/ the limitations of dts and I have no problem spending time writing connectors or whatever to provide more functionality. right now we have this piece of poo poo esb (mule) that I want to throw away and ssis will let me throw away like 90% of what we use mule for.

have you looked at fuse esb?

if you have to integrate with ANY linux or unix EVER then ssis is going to suck for you (beyond it's normal stupid limitations)

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Police Academy III posted:

I'm not sure if I'd call clojure optionally typed since no actual type checking goes on. there's nothing to stop you from doing (def ^int an-int "totally not an int") for example.

e: but seriously optional typing is really the most obvious way to get the best of both worlds and i wish more languages supported it. also actionscript is optionally typed, hilariously enough.

actionscript is a lot like javascript, only moreso. it's a better ecmascript and it's trapped in a worse environment.

Shaggar
Apr 26, 2006

trex eaterofcadrs posted:

have you looked at fuse esb?

if you have to integrate with ANY linux or unix EVER then ssis is going to suck for you (beyond it's normal stupid limitations)


no I haven't looked at fuse. i think the plan is to replace mule w/ BizTalk. the thing is im the only guy who understands linuxes and I don't have time to build all the monitoring/admin tools that BizTalk would provide into mule.

also idk about integrating ssis w/ a Linux, but im sure it can integrate fine w/ services on a Linux. also we'll probably get rid of most of the linuxes we have here eventually. we've already been deploying everything (including tomcat) to windows when new servers are needed so Linux will be phased out as old services are upgraded.

Shaggar
Apr 26, 2006
like maybe fuse is good? idk? but i don't have the time or the patience to be the guy dealing with both the Linux administration and the Linux development.

Sang-
Nov 2, 2007

Malcolm XML posted:

Technically dynamic languages have exactly one type ( haskell's data.dynamic allows you to do some neat things)

Also one if the dumber things about ghc is that with two commonly used type system extensions you can thoroughly break it by writing unsafeCoerce

Scala has dynamic too :3

Scalaz is very awesome too.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
fuse is super #1 because of sshfs

JawnV6
Jul 4, 2004

So hot ...

tef posted:

ps wadler wrote a paper on threesomes with an without blame

we aaaaaaaaall agreed to be one kind at first but someone changed at runtime

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Shaggar posted:

like maybe fuse is good? idk? but i don't have the time or the patience to be the guy dealing with both the Linux administration and the Linux development.

you can deploy it on windows, the main reason its integration is so good is because of camel. obviously that only really matters in hetero environments. if youre going all win then it's prob not worth it

i really like fuse because of mvn + camel + osgi. it makes my life so much better to not have to worry about version of this or jar of that and just let the thing handle itself. but i hear ya on the linux admin poo poo, i just deploy my poo poo to the ~*cloud*~ and let jmx tell me if something is wrong

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

Well, no, this is not true, and the only people who say this have heads so broken they can't imagine otherwise.

bob harper disagrees with you

Bream
Feb 3, 2013

Farmer's Barket
But what about when you compile c++ with -fno-rtti?! Is my naivete revealing itself when I say that I can't think of an example where a runtime error would be preferable to a compiler error?

graph
Nov 22, 2006

aaag peanuts
this thread is loving awful

JewKiller 3000
Nov 28, 2006

by Lowtax

Bream posted:

Is my naivete revealing itself when I say that I can't think of an example where a runtime error would be preferable to a compiler error?

actually it's your common sense

tef
May 30, 2004

-> some l-system crap ->

i believe the post that I wrote already explained this

"Well, no, this is not true, and the only people who say this have heads so broken they can't imagine otherwise."

i'd put you on two for two on not reading my post or his strawman

tef
May 30, 2004

-> some l-system crap ->
whether or not a compiler balks at a possible runtime error at compile time is a feature of the compiler, not the language.

languages with explicit type annotations make this easier for dumb compilers, and some smarter languages let you annotate just enough for it to infer the rest. smarter languages still let you type check your program, and run it too. without predicating one on the other. haskell for instance lets you defer errors to runtime.

Bream
Feb 3, 2013

Farmer's Barket

tef posted:

whether or not a compiler balks at a possible runtime error at compile time is a feature of the compiler, not the language.

languages with explicit type annotations make this easier for dumb compilers, and some smarter languages let you annotate just enough for it to infer the rest. smarter languages still let you type check your program, and run it too. without predicating one on the other. haskell for instance lets you defer errors to runtime.

Sure, I can dig it. Have you ever used that, or can you think of a circumstance in which you'd want to do that? (serious q)

tef
May 30, 2004

-> some l-system crap ->
"Dynamic typing is but a special case of static typing, "

Or, static typing is a special case of dynamic typing. Makes as much sense. It's like saying 0 is a special case of 1.

Sure enough you can simulate a dynamic language by having one ginormous union type in a explicitly typed language, and weirdly enough you can do the opposite too, simulating a static language in a dynamic one is also possible. WOAH MIND BLOWN

If you learned logic you'd understand what a contrapositive is.

tef
May 30, 2004

-> some l-system crap ->

Bream posted:

Sure, I can dig it. Have you ever used that, or can you think of a circumstance in which you'd want to do that? (serious q)


if I asked, 'can you ever think why it might be easy to debug failure by running code that doesn't pass tests', would you have an answer for that?


explicit type checks, tests and other forms of verification are useful, but as anyone who has tried to understand STL errors, sometimes it's easier to understand how your code got that way than how the error is reported.

tef
May 30, 2004

-> some l-system crap ->
i'm waiting for the classic scoff where someone indicates how not understanding hm type inference is a valid reason to make programs hard to debug, and then ignore that haskell has allowed you to defer errors to runtime for months now, to aid debugging and prototyping

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
weed is a special case of balls

Bream
Feb 3, 2013

Farmer's Barket

tef posted:

if I asked, 'can you ever think why it might be easy to debug failure by running code that doesn't pass tests', would you have an answer for that?


explicit type checks, tests and other forms of verification are useful, but as anyone who has tried to understand STL errors, sometimes it's easier to understand how your code got that way than how the error is reported.

Okay, yeah, I can see how being able to trace something or look at real, live state at the time an error occurred would be easier than running something in your head.

tef
May 30, 2004

-> some l-system crap ->

Bream posted:

Okay, yeah, I can see how being able to trace something or look at real, live state at the time an error occurred would be easier than running something in your head.

My head is small and my programs run across different machines in subtle ways. Logging saves my butt almost as much as defensive coding, failing fast, isolation and process supervision does. I haven't found that being explicit about types has made a significant difference in program quality, because so much of the errors I encounter are transient hardware issues. Handling all errors by supervision, isolation and all that stuff means I implicitly handle my lovely code too. It tends to make things work most of the time, and prevent one bug collapsing the system.

there is also an argument that dynamic types make it easier to update running code in production, without having to turn things on and off again as a whole.

I'd really like to be able to write code and then introduce annotations that could be optionally checked by runtime, but not have the program be constrained by the checking, or my types to be limited in the same way. That I can't add a type for a string of a certain format, and handle validation cleanly, in almost any language static or dynamic, means I'm always forced to check things at runtime.

if I could write types as functions, that would be neat. if the compiler could work out when those runtime checks are always true, or always false, it could either elminate the code, or tell me about the problem code. this is actually what a language called sage does.

Max Facetime
Apr 18, 2009

tef posted:

That I can't add a type for a string of a certain format, and handle validation cleanly, in almost any language static or dynamic, means I'm always forced to check things at runtime.

just use java

Java code:
  private void addAttributes(ByteBuffer source) {
    findMatchingVariables(
      source,
      "attribute\\s+(\\w+)\\s+(\\w+)\\s*;",
      attributes);
  }

  private static void findMatchingVariables(ByteBuffer source,
  /*@Regex(2)*/String regexp, List<VariableInfo> variables) {
    Matcher matcher =
      Pattern.compile(regexp).matcher(parseAsAscii(source));
    while(matcher.find()) {
      String type = matcher.group(1);
      if(type != null) {
        String name = matcher.group(2);
        if(name != null) {
          variables.add(new VariableInfo(name, type));
        }
      }
    }
  }
that little @Regex(2) annotation says that the parameter has to a well-formed regular expression and it has to have 2 capturing groups, I believe there's a runtime function too that either throws or gives you a string with that annotation in place

MononcQc
May 29, 2007


  • Smalltalk (Strongtalk): http://strongtalk.org/ -- "The type system is both optional and incremental, and operates completely independently of the compiler technology (which means that normal untyped Smalltalk code runs just as fast as typed code)."
  • Erlang (Dialyzer): http://learnyousomeerlang.com/dialyzer -- uses success types, tries not to prove that a program is error-free when it comes to types, but only to find as many errors as possible without ever contradicting what happens in the real world
  • Racket: Typed Racket -- A racket sublanguage that allows specific modules to have type annotations and verifications at compile-time, debuggable, using union types
  • Clojure: libraries such as typed-clojure (apparently now core.typed) allow gradual typing in clojure with annotations and whatnot.
  • Qi / Shen: Shen is the new version of Qi, which aims to integrate optional static typing as part of the design of the language. It can be turned on and off on-demand.
  • Dylan: I have no link on this one in details. The language is supposed to support it natively, but I'm not even sure Dylan is maintained anymore.
  • Modula-3 (allowed unsafe modules): Modula-3 was statically typed by default. They however made it possible to set some modules (say modules that interface with outside programs or hardware) as explicitly unsafe and dynamic.
  • Python: Nothing I've seen was used broadly. A weaker source is recommended in PEP 3107 (which was denied), and some specific projects (see http://www.artima.com/weblogs/viewpost.jsp?thread=85551)

MononcQc fucked around with this message at 03:57 on Mar 5, 2013

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

i believe the post that I wrote already explained this

"Well, no, this is not true, and the only people who say this have heads so broken they can't imagine otherwise."

i'd put you on two for two on not reading my post or his strawman

normally i respect your opinion because you seem well educated, but i'm gonna have to defer to professor harper on this one, sorry. whatever lame excuses you might use against me ("hurrrr learn logic") surely do not apply to him. i doubt you understood his post if you think it's just a strawman

Shaggar
Apr 26, 2006

Win8 Hetro Experie posted:

just use java

Java code:
  private void addAttributes(ByteBuffer source) {
    findMatchingVariables(
      source,
      "attribute\\s+(\\w+)\\s+(\\w+)\\s*;",
      attributes);
  }

  private static void findMatchingVariables(ByteBuffer source,
  /*@Regex(2)*/String regexp, List<VariableInfo> variables) {
    Matcher matcher =
      Pattern.compile(regexp).matcher(parseAsAscii(source));
    while(matcher.find()) {
      String type = matcher.group(1);
      if(type != null) {
        String name = matcher.group(2);
        if(name != null) {
          variables.add(new VariableInfo(name, type));
        }
      }
    }
  }
that little @Regex(2) annotation says that the parameter has to a well-formed regular expression and it has to have 2 capturing groups, I believe there's a runtime function too that either throws or gives you a string with that annotation in place

blargh. dynamic typing is gross

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

I'd really like to be able to write code and then introduce annotations that could be optionally checked by runtime, but not have the program be constrained by the checking, or my types to be limited in the same way.

so you want an assertion?

tef posted:

That I can't add a type for a string of a certain format, and handle validation cleanly, in almost any language static or dynamic, means I'm always forced to check things at runtime.

are you serious? using ML as an example: create a module containing a type validated_string which is abstract to the outside world. in this module's interface, provide a function to create a validated_string from a plain string, which checks for the formatting you wanted. your interface should export no other way to create a validated_string. now make all the necessary functions require a validated_string as input, and the compiler will ensure it is always the case :confused:

MononcQc
May 29, 2007


I've always wondered how that view fits with an idea like this one:

I take my Haskell code, and each type class I have or whatever instead becomes some kind of hidden tuple that I get to evaluate at run time instead. So that something like 'Tree a' is in fact '(Tree a)', where 'Tree' is some kind of label only the runtime system (say a VM) could see and evaluate as in a strong dynamic type system.

My Haskell suddenly becomes dynamic, but only for that specific implementation. I only decided to defer the evaluation of the types to the run time rather than doing it at compile time (or I could even do both, even if it would be useless).

Does Haskell suddenly become unityped? Has the language definition drastically changed? Is the level of typedness decided by the compiler's type checker or by the language specification?

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

i'm waiting for the classic scoff where someone indicates how not understanding hm type inference is a valid reason to make programs hard to debug, and then ignore that haskell has allowed you to defer errors to runtime for months now, to aid debugging and prototyping

here you go then:

if a person does not understand hindley-milner type inference, that is a valid reason to tell him to choose another career path. i'm serious, if you cannot grok a simple unification algorithm that basically boils down to "the caller must be consistent with the callee", you belong as far away from source code as society can possibly place you

JewKiller 3000
Nov 28, 2006

by Lowtax

MononcQc posted:

Does Haskell suddenly become unityped? Has the language definition drastically changed? Is the level of typedness decided by the compiler's type checker or by the language specification?

hmm that's an interesting question! i'm not sure, but because harper likes standard ML, i suspect he would defer to the language specification, which might "prevent" you from deferring type checks until runtime

FamDav
Mar 29, 2008
static typing with template support owns bones. haskell and c++ are the two greatest languages in the world.

MononcQc
May 29, 2007

JewKiller 3000 posted:

so you want an assertion?

It can be a bit like an assertion, but the idea could be more flexible. You could see it as a protocol checker that sits between two actors or endpoints and analyzes the transactions, logs errors and sends notification without crashing if you wanted.

The same way someone could do XML schema validation and still decide to process broken but still manageable requests (or queue them for human treatment or whatever), you could special-case handling of broken type contracts that would be stricter than what the actual dynamic program is ready to accept and deal with.

The idea would be that the same way you can use optional type checking to tell you "this poo poo will break" but compile anyway, you could turn up or down how strict your protocol checking is at run-time by telling the VM or interpreter or whatever whether it should start enforcing the annotations or not, and if so, how strict it should be at it.

MononcQc
May 29, 2007

JewKiller 3000 posted:

hmm that's an interesting question! i'm not sure, but because harper likes standard ML, i suspect he would defer to the language specification, which might "prevent" you from deferring type checks until runtime

But Haskell allows to defer type errors to the run-time on GHC! Is Haskell sometimes unityped now? That's what tef was getting at, I think.

Opinion Haver
Apr 9, 2007

tef posted:

ps wadler wrote a paper on threesomes with an without blame which talks about writing a type system for dynamic languages that allows runtime casts but preserves enough information to know where the issue came from and haskell lets you defer errors to runtime too. seriously.

-fdefer-type-errors, and -XTypeHoles are two of the greatest assets to haskell programming imo

JewKiller 3000
Nov 28, 2006

by Lowtax

MononcQc posted:

But Haskell allows to defer type errors to the run-time on GHC! Is Haskell sometimes unityped now?

basically i think harper is arguing that, since a language like haskell can be made "dynamically typed" when necessary as you describe, but in addition it also supports other static types, there is no reason to use so-called dynamic languages where the unitype is the only one available

Adbot
ADBOT LOVES YOU

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
it turns out that's a dopey thing to say

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply