219 |
220 |
221 |
222 |
223 |
224 |
--------------------------------------------------------------------------------
/Python/Example.py:
--------------------------------------------------------------------------------
1 | from threading import Thread
2 |
3 |
4 | class X:
5 | def __init__(self):
6 | def run():
7 | pass
8 |
9 | self._thread = Thread(None, run)
10 | self._thread.start()
11 |
12 | def value(self):
13 | self._thread.join()
14 | return self._value
15 |
--------------------------------------------------------------------------------
/Python/README.md:
--------------------------------------------------------------------------------
1 | # Live Typing for Python
2 | Coming soon!
3 |
--------------------------------------------------------------------------------
/Python/live_typing.py:
--------------------------------------------------------------------------------
1 | from python3 cimport PyFrameObject, PyObject, PyStringObject
2 |
3 | import unittest
4 |
5 | class Example:
6 | def m1(self):
7 | return 10
8 |
9 | class LiveTyping:
10 | @classmethod
11 | def keep_types_while(cls,closure):
12 | pass
13 |
14 | cdef
15 | int
16 | python_trace_callback(object
17 | self_, PyFrameObject * py_frame, int
18 | what,
19 | PyObject * arg):
20 |
21 | class LiveTypingTest(unittest.TestCase):
22 |
23 | def test_1(self):
24 | LiveTyping.keep_types_while(lambda: Example().m1())
25 | self.assertTrue(True)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Live Typing - Automatic Type Annotation for Dynamically Typed Languages
2 | Live Typing annotates variable types automatically based on the objects assigned to them. It also annotates method’s return types based on the returned objects. This information combined with a Live Development Environment brings some of the benefits of Static Typing to Dynamically Typed Languages without losing their characteristics but enhancing them.
3 |
4 | Live Typing is based on the fact that Live Development Environments run under the same VM that the system under development is tested and run. Type information can be obtained from the running code no matter if that code is part of the language’s core, the development tools or the system under development. The more code is run the more type info it will provide.
5 |
6 | Every time an object is assigned to a variable, whether it is an instance variable, a parameter or a temporary one, the VM keeps the class of the assigned object in a collection of types that can be consumed from the running environment. The same happens for method’s returns. Development tools of Dynamically Typed Languages can be heavily improved using the collected type info. For example, refactorings can be scoped based on the type info, autocomplete can show only understood messages by the receiver in a static context and so on.
7 |
8 | For this feature to be usable, the VM has to collect this information as fast as possible, in objects that have to be accessed and configured from the running environment.
9 |
10 | # Implementations
11 | Live typing is currently implemented for Smalltalk, in particular using the Stack VM of the OpenSmalltalk VM (https://github.com/OpenSmalltalk/opensmalltalk-vm) and Cuis (https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev). A experimental version is also available for Squeak, an Pharo is on the way.
12 |
13 | After having a complete implementation for Smalltalk we will implemented for Ruby and Python
14 |
15 | # Media
16 | See *Videos* for videos, demos and presentations in conferences.
17 |
18 | See *Tweets* for links to tweets
19 |
--------------------------------------------------------------------------------
/Ruby/README.md:
--------------------------------------------------------------------------------
1 | # Live Typing for Ruby
2 | Coming soon!
3 |
--------------------------------------------------------------------------------
/Smalltalk/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Hernan Wilkinson
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Smalltalk/README.md:
--------------------------------------------------------------------------------
1 | # Live Typing
2 | Changes to the the opensmalltalk-vm and Cuis image to generate dynamic type information
3 |
4 | Look for the VM of you OS at the VMs directory.
5 | There is a Cuis image with everything install to play with.
6 |
7 | ## How to use it
8 | Type information is stored based on execution. Because Smalltalk is a live environment, type info is stored all the time.
9 | There are many ways to see and use type info:
10 | - Senders: If you use the editor menu option "Typed Senders of it (B)", it will show only the senders based on the type information.
11 | - Implementors: There is also a editor menu option "Typed Implementors of it (M)" that shows implementors based on type info
12 | - See type info: The option "Print type info (P)" shows the type info of the element where the cursor is. It can be an instance variable, a temporary variable, a message (in which case shows the return type of the message based on the receivers type info) and the return of the method (when the cursor is at the caret). You can add and remove types from the menu or browse a class.
13 | - If you want to see the type info all the time, you can select the option "typed source" from the "show..." button in the browser. Doing so, the browser will show type info for the class definition and methods.
14 | - Rename selector: The rename selector refactoring has a scope option named "Typed". If you select that option then the rename will be based on the type info. That is, it will use typed senders and typed implementors to do the rename, even inside the same method.
15 |
--------------------------------------------------------------------------------
/Smalltalk/VMMaker/Cuis-Reader.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMMaker/Cuis-Reader.zip
--------------------------------------------------------------------------------
/Smalltalk/VMMaker/CuisUniversity-Reader.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMMaker/CuisUniversity-Reader.zip
--------------------------------------------------------------------------------
/Smalltalk/VMMaker/ReaderImage.pck.st:
--------------------------------------------------------------------------------
1 | 'From Cuis 5.0 [latest update: #3826] on 16 July 2019 at 2:28:39 pm'!
2 | 'Description '!
3 | !provides: 'ReaderImage' 1 0!
4 | SystemOrganization addCategory: #ReaderImage!
5 |
6 |
7 | !classDefinition: #StdioListener category: #ReaderImage!
8 | Object subclass: #StdioListener
9 | instanceVariableNames: 'quitOnEof stdin stdout stderr'
10 | classVariableNames: ''
11 | poolDictionaries: ''
12 | category: 'ReaderImage'!
13 | !classDefinition: 'StdioListener class' category: #ReaderImage!
14 | StdioListener class
15 | instanceVariableNames: ''!
16 |
17 |
18 | !StdioListener class methodsFor: 'as yet unclassified' stamp: 'HAW 10/3/2018 19:50:26'!
19 | startUp: resuming
20 | "
21 | Smalltalk addToStartUpList: self
22 | "
23 | resuming ifTrue: [ self run ]! !
24 |
25 | !StdioListener methodsFor: 'initialize-release' stamp: 'HAW 10/3/2018 19:42:31'!
26 | initialize
27 | quitOnEof := true.
28 | stdin := StdIOReadStream stdin.
29 | stdout := StdIOWriteStream stdout.
30 | stderr := StdIOWriteStream stderr! !
31 |
32 | !StdioListener methodsFor: 'run loop' stamp: 'eem 5/14/2009 17:46'!
33 | logError: errMsg inContext: aContext to: aStream
34 | aStream nextPutAll: errMsg; cr.
35 | aContext errorReportOn: aStream.
36 | aStream cr! !
37 |
38 | !StdioListener methodsFor: 'run loop' stamp: 'HAW 7/16/2019 14:28:16'!
39 | run
40 | [stdin atEnd] whileFalse:
41 | [| nextChunk |
42 | stdout nextPutAll: 'squeak> '; flush.
43 | nextChunk := stdin nextChunkNoTag.
44 | [nextChunk notEmpty and: [nextChunk first isSeparator]] whileTrue:
45 | [nextChunk := nextChunk allButFirst].
46 | Transcript cr; nextPutAll: nextChunk; cr; flush.
47 | [stdout print: (Compiler evaluate: nextChunk); newLine; flush]
48 | on: Error
49 | do: [:ex| self logError: ex description inContext: ex signalerContext to: stderr]].
50 | quitOnEof ifTrue:
51 | [SourceFiles at: 2 put: nil.
52 | Smalltalk snapshot: true andQuit: true]! !
53 |
54 | !StdioListener methodsFor: 'accessing' stamp: 'eem 5/14/2009 17:36'!
55 | quitOnEof
56 | ^quitOnEof! !
57 |
58 | !StdioListener methodsFor: 'accessing' stamp: 'eem 5/14/2009 17:36'!
59 | quitOnEof: aBoolean
60 | quitOnEof := aBoolean! !
61 |
62 | !StdioListener class methodsFor: 'as yet unclassified' stamp: 'HAW 10/3/2018 19:39:13'!
63 | run
64 |
65 | [StdioListener new run] forkAt: Processor activePriority + 1.! !
66 |
67 | !StdIOReadStream methodsFor: '*ReaderImage' stamp: 'HAW 7/16/2019 14:23:40'!
68 | nextChunkNoTag
69 | "Answer the contents of the receiver, up to the next terminator character.
70 | Doubled terminators indicate an embedded terminator character.
71 | Unlike nextChunk, do not look for ]lang[ tags."
72 | | skippingSeparators terminator out ch |
73 | terminator := $!!.
74 | skippingSeparators := true. "inline skipSeparators since restoreStateOf:with: is not reliable"
75 | out := WriteStream on: (String new: 1000).
76 | [(ch := self next) == nil] whileFalse:
77 | [ch == terminator ifTrue:
78 | [self peek == terminator
79 | ifTrue:"skip doubled terminator"
80 | [self next]
81 | ifFalse:
82 | [^out contents "terminator is not doubled; we're done!!"]].
83 | (skippingSeparators and: [ch isSeparator]) ifFalse:
84 | [out nextPut: ch.
85 | skippingSeparators := false]].
86 | ^out contents! !
87 |
--------------------------------------------------------------------------------
/Smalltalk/VMMaker/VMMaker.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMMaker/VMMaker.zip
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2440.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2440.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2441.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2441.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2442.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2442.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2443.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2443.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2444.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2444.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2445.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2445.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMSources/VMMaker.oscog-HAW.2446.mcz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMSources/VMMaker.oscog-HAW.2446.mcz
--------------------------------------------------------------------------------
/Smalltalk/VMs/linux64/sqstkspur64linuxht.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMs/linux64/sqstkspur64linuxht.tar.gz
--------------------------------------------------------------------------------
/Smalltalk/VMs/macos64/Pharo.app.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMs/macos64/Pharo.app.zip
--------------------------------------------------------------------------------
/Smalltalk/VMs/macos64/Squeak.app.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMs/macos64/Squeak.app.zip
--------------------------------------------------------------------------------
/Smalltalk/VMs/windows64/Squeak.exe.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/VMs/windows64/Squeak.exe.zip
--------------------------------------------------------------------------------
/Smalltalk/__LiveTyping-TestData__.pck.st:
--------------------------------------------------------------------------------
1 | 'From Cuis 5.0 of 7 November 2016 [latest update: #3634] on 28 February 2019 at 8:27:21 pm'!
2 | 'Description Please enter a description for this package'!
3 | !provides: '__LiveTyping-TestData__' 1 1!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Smalltalk/image/CuisLiveTyping.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/image/CuisLiveTyping.zip
--------------------------------------------------------------------------------
/Smalltalk/image/ESUG2019ExampleImage.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/image/ESUG2019ExampleImage.zip
--------------------------------------------------------------------------------
/Smalltalk/image/PharoLiveTyping.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/image/PharoLiveTyping.zip
--------------------------------------------------------------------------------
/Smalltalk/image/Smalltalks2019ExampleImage.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/image/Smalltalks2019ExampleImage.zip
--------------------------------------------------------------------------------
/Smalltalk/image/Squeak5.2-18225-64bit-LTI.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hernanwilkinson/LiveTyping/001ee1a61ad5f023f4d8b053e8c1a355182e3df0/Smalltalk/image/Squeak5.2-18225-64bit-LTI.zip
--------------------------------------------------------------------------------
/Tweets/README.md:
--------------------------------------------------------------------------------
1 | # Tweets
2 | I'm using #LiveTyping as hashtag for live typing related Tweets
3 | Here is a list of some of them:
4 | - https://twitter.com/HernanWilkinson/status/1085869216857817090
5 | - https://twitter.com/HernanWilkinson/status/1086224152045019137
6 | - https://twitter.com/HernanWilkinson/status/1087325709289357312
7 | - https://twitter.com/HernanWilkinson/status/1092918263007379456
8 | - https://twitter.com/HernanWilkinson/status/1161971302938398721
9 | - https://twitter.com/HernanWilkinson/status/1189699911169777664?s=20
10 |
11 | ESUG 2019
12 | - https://twitter.com/NicolasPapagna/status/1166751407644585984?s=20
13 | - https://twitter.com/NicolasPapagna/status/1166751407644585984?s=20
14 | - https://twitter.com/nchillo/status/1166663017515421696?s=20
15 | - https://twitter.com/nourybouraqadi/status/1166659466588250112?s=20
16 | - https://twitter.com/cdrick65/status/1166659541423075328?s=20
17 | - https://twitter.com/__pocho__/status/1166652068603584513?s=20
18 |
--------------------------------------------------------------------------------
/Videos/README.md:
--------------------------------------------------------------------------------
1 | # Links to videos
2 | - Youtube list: https://www.youtube.com/playlist?list=PLMkq_h36PcLBCSqEvEXf9V03fNEf_nqjO
3 | - Live typing for Cuis Smalltalk Demo: https://youtu.be/1b3RRE9a8NA
4 | - Smalltalks 2018 presentation: https://www.youtube.com/watch?v=bozTnos8d9U
5 | - ESUG 2019 presentation: https://www.youtube.com/watch?v=nFaB07q-7MI
6 | - Smalltalks 2019 presentation: https://www.youtube.com/watch?v=N5Rf5O7mcWU&list=PLCGAAdUizzH23OEPEZyrziP5iTevW-x0W&index=31
7 | - California Smalltakers 2021 presentation: https://www.youtube.com/watch?v=4fS7Bu_O-Sk
8 | - UK Smalltalk User Group: https://www.youtube.com/watch?v=t8xf5YReV50
9 | - Refactorings using LiveTyping: https://www.youtube.com/watch?v=aF93NKwiwAk
10 | - Smalltalks 2023: https://www.youtube.com/watch?v=DbYCVY1eLpA&list=PLCGAAdUizzH19WfDNkQzeoULkIpjhDZoq&index=2
11 |
--------------------------------------------------------------------------------