4 ms·
is there such thing as a typed interpreted language? I mean one with a REPL, not Java.
by symlinkk 11y ago
is there such thing as a typed interpreted language? I mean one with a REPL, not Java.
- wsh91 11y agoScala is strongly, statically typed with a REPL.
- logicchains 11y agoOCaml and Haskell both have interpreters.
- gnaddel 11y agoJulia: http://julialang.org/ http://julialang.org/ (Typing is optional)
- mebassett 11y agoThere is Typed Racket. It's essentially a scheme with static type checking, which works from the REPL. http://docs.racket-lang.org/ts-guide/index.html http://docs.racket-lang.org/ts-guide/index.html
- sunaurus 11y agoJava is actually getting a REPL with Java 9.
- klibertp 11y ago> is there such thing as a typed interpreted language? Of course. Examples: ▶ ocaml OCaml version 4.02.3 # 9;; - : int = 9 ▶ ghci GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> 9 9 Prelude> :t 9 9 :: Num a => a Prelude> ▶ drracket Welcome to DrRacket, version 6.3.0.2--2015-10-28(-/f) [3m]. Language: typed/racket; memory limit: 128 MB. > 9 - : Integer [more precisely: Positive-Byte] 9 ▶ scala Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.8.0_91). Type in expressions to have them evaluated. Type :help for more information. scala> 9 res0: Int = 9 There are even interpreters for C (http://www.drdobbs.com/cpp/ch-a-cc-interpreter-for-script-computing/184402054 http://www.drdobbs.com/cpp/ch-a-cc-interpreter-for-script-co...). tl;dr: you can have a REPL in both statically and dynamically typed languages.
- agravier 11y agoPython (and many others) is a typed interpreted language. It's not statically typed, but it is typed.
- ericfrederich 11y agoNot just typed, Python is strongly typed.
- riffraff 11y agoI think most (S)ML implementations have a repl. So does GHC AFAIR. It's really not uncommon :)
- n72 11y agoKotlin has a repl
- zeckalpha 11y agoJava has a repl: https://github.com/albertlatacz/java-repl https://github.com/albertlatacz/java-repl
- Xophmeister 11y agoPresumably, ultimately, all languages are typed in some way. Otherwise, how would the interpreter (or whatever execution environment is relevant) deduce what binary data was what? I think the question you mean -- which I'm also interested in the answer to -- is: How can a dynamically typed language be statically type checked? Presumably Hindley-Milner style inference doesn't/can't work. Do static analysers such as Mypy therefore trace the execution of the code until it finds something that conflicts? Are there cases where this approach won't work, either technically or practically?
- boomlinde 11y agoForth is what I would consider an untyped language. It deals with numbers on a stack in a way that it is totally up to the programmer to decide what they represent. One number may be a IEEE 754 number, an unsigned integer, a signed integer, the address of a string, a fixed-point number, a couple of ASCII characters etc.
- RodgerTheGreat 11y agoSame deal with most forms of assembly language- the values you work with are just numbers, and the operations to which you apply them are what give them a particular meaning at a particular point in time- addresses, offsets, integers, booleans, etc. It's possible to argue that such languages are "unityped" rather than "untyped", but I think to do so is to produce such a loose interpretation of "types" as to be uninteresting.
- kenko 11y ago> Otherwise, how would the interpreter (or whatever execution environment is relevant) deduce what binary data was what? Via runtime tags, which are not the same as types.
- lacksconfidence 11y agophp7
- rurban 10y agoThose were missing: Most lisps, perl6, cperl, php 7, ruby 3