not a lot of people know that v2.0 andy shiers, coo

34
Not a lot of people know that v2.0 Andy Shiers, COO

Upload: darren-newman

Post on 18-Jan-2018

226 views

Category:

Documents


0 download

DESCRIPTION

Capsules A capsule is the outermost dfn of a (possibly empty) set of nested dfns Some editor and tracer features work at the capsule level The concept of the capsule is likely to become more prominent in future versions

TRANSCRIPT

Page 1: Not a lot of people know that v2.0 Andy Shiers, COO

Not a lot of people know that v2.0Andy Shiers, COO

Page 2: Not a lot of people know that v2.0 Andy Shiers, COO

2

Synopsis• We should have said ..

– Miscellaneous notes from earlier presentations• I'd like to point out ..

– Some small but important/interesting things• A regular favourite ..

– Editor and Tracer• What's in a (workspace) name ..

– Well, it's obvious, innit ?• What does that mean ..

– A small comment hides a wealth of interest ..• That’s All Folks

Page 3: Not a lot of people know that v2.0 Andy Shiers, COO

Capsules• A capsule is the outermost dfn of a

(possibly empty) set of nested dfns • Some editor and tracer features work

at the capsule level• The concept of the capsule is likely to

become more prominent in future versions

Page 4: Not a lot of people know that v2.0 Andy Shiers, COO

Scripted Objects• In 14.1 you cannot have two

definitions of the same-named one-line dfn– This is now consistent with attempts to

redefine tradfns and multi-line dfns

:Namespace andys foo←{⍺ ⍵} foo←{⍺,⍵} :Endnamespace

Will not fix !

Page 5: Not a lot of people know that v2.0 Andy Shiers, COO

Altering the Language Bar• Have always been able to adjust it• Was all too easy to delete entries• In 14.1 can now Reset to default

• For earlier versions, send us an email.

• Applies to old IDE only– RIDE language bar is not alterable

Page 6: Not a lot of people know that v2.0 Andy Shiers, COO

Editor/Tracer

• dfns: can now view ⍺ ⍺⍺ ⍵ ⍵⍵– Unlikely to make these editable– Unlikely to add ∇ - you're already looking

at it !

Page 7: Not a lot of people know that v2.0 Andy Shiers, COO

Editor/Tracer• Align Comments:

– 14.0: Worked only in simple functions– 14.1: Works in scripted objects too

• On selected text• On current tradfn

– Any dfns defined in tradfn will also have comments aligned

• On current capsule

Page 8: Not a lot of people know that v2.0 Andy Shiers, COO

Editor/Tracer• Skipping lines

– 14.0: • can select Skip Blank Lines and Comments

or not– 14.1:

• can select Skip Blank Lines or not• can select Skip Comment Lines or not

– Still always stops on line[1]– Still always stops on the last line of a

tradfn

Page 9: Not a lot of people know that v2.0 Andy Shiers, COO

⎕ED and Variants• ReadOnly: 0 or 1

– Only allows you to not alter an object that by default could be altered

– Doesn't enable editing of objects that cannot be altered !

• EditName: Default, Allow, Disallow– Returns list of names that have changed or

been created– Default is Disallow, it will always remain so

Page 10: Not a lot of people know that v2.0 Andy Shiers, COO

Workspace filenames)save myws

Windows 14.0 and prior:

myws.DWS14.1

myws.dws

Page 11: Not a lot of people know that v2.0 Andy Shiers, COO

WSEXT• Windows users expect file extensions,

UNIX users (generally) don't• There is no one "right" way

– ⎕io– vi vs emacs

Of course there is: correct answers are none, 1, vi

• Need cross-platform support– 'DRC' ⎕cy'conga'– We see more multi-platform systems now

Page 12: Not a lot of people know that v2.0 Andy Shiers, COO

WSEXT• WSEXT

– Defines what APL appends to filenames– Allows cross-platform code to be written– But

• Can cause some confusion• May cause apparently odd errors

Page 13: Not a lot of people know that v2.0 Andy Shiers, COO

WSEXT• WSEXT

– is a colon delimited list– elements can be empty– it is a standard configuration parameter– First element is used by default for )SAVE

• WSEXT default values:– Windows .dws:– Non-Windows :.dws:.DWS

Page 14: Not a lot of people know that v2.0 Andy Shiers, COO

WSEXT• Be aware of interaction between WSEXT and

WSPATH– outer loop is elements of WSEXT– inner loop is element of WSPATH– for all but )DROP, the first hit is the one that is used

• for )DROP for multiple hits, all are displayed and nothing is deleted

Page 15: Not a lot of people know that v2.0 Andy Shiers, COO

WSEXT• )WSID always includes any file extension• On Windows all system commands that report

workspace names will have at least one "." in each name

• No changes have been made to ⎕WSID

Page 16: Not a lot of people know that v2.0 Andy Shiers, COO

Shared pockets and 127⌶

• 127⌶: Overwrite Free Pockets– "It is the responsibility of the

programmer to ensure that there are no USED pockets in the workspace that reference the data."

– What's this all about ?

Page 17: Not a lot of people know that v2.0 Andy Shiers, COO

Shared pockets and 127⌶

• Will mention:– Pockets– ⎕wa, 2000⌶, ⎕size, ⎕dm/⎕dmx

• Won't mention:– Much of what is in a pocket, much of what is in

a workspace (will not be documented)– How memory is managed (partially

documented)

Page 18: Not a lot of people know that v2.0 Andy Shiers, COO

Let's have some data !

04W24W0W04100000W40000110W020000401000W000000000101000011W0011200010040040000W1W30000000000000400000000000001004W

2015-08-06

Page 19: Not a lot of people know that v2.0 Andy Shiers, COO

Isn't Key wonderful ?

a←'04W24W0W04100000W40000110W020000401000W000000000101000011W0011200010040040000W1W30000000000000400000000000001004W' {⍵[⍋⍵[;1];]} ,∘≢⌸a0 771 132 33 14 9W 10

• (,∘≢⌸a can be written as {⍺,≢⍵}⌸a)

• For England supporters: isn't that a wonderful thing to behold ?

Page 20: Not a lot of people know that v2.0 Andy Shiers, COO

What is a Workspace ?

A lot of pockets, a lot of pointers

Symbol

Class

Free space

DMX

OthersSymbolData Data Data Free spaceOthers ..

Symbol Symbol Free space Function Others ..

Page 21: Not a lot of people know that v2.0 Andy Shiers, COO

Data Pocket

Data:04W24W0W04100000W40000110W020000401000W000000000101000011W0011200010040040000W1W30000000000000400000000000001004W

Other meta data

Type: CharacterRank: 1Length: 113

Data Pocket

Page 22: Not a lot of people know that v2.0 Andy Shiers, COO

A Simple VariableInnings←'04W24W..'

Other meta data

Type: SymbolName: InningsValue:

Data:04W24W0W04100000W40000110W020000401000W000000000101000011W0011200010040040000W1W30000000000000400000000000001004W

Other meta data

Type: CharacterRank: 1Length: 113

Page 23: Not a lot of people know that v2.0 Andy Shiers, COO

A Nested VariableInnings2←⊂'04W24W..'

Other meta data

Type: SymbolName: Innings2Value:

Data:04W24W0W04100000W40000110W020000401000W000000000101000011W0011200010040040000W1W30000000000000400000000000001004W

Other meta data

Type: CharacterRank: 1Length: 113

Data:Other meta data

Type: PointerRank: 0Length: -

Page 24: Not a lot of people know that v2.0 Andy Shiers, COO

Sharing PocketsWorthRepeating←5 2⍴⊂Innings

Data:04W24W0W04100000W40000110W020000401000W000000000101000011W0011200010040040000W1W30000000000000400000000000001004W

Other meta data

Type: CharacterRank: 1Length: 113

Other meta data

Type: SymbolName: InningsValue:

Other meta data

Type: SymbolName:WorthRepeatingValue:

Data:Other meta data

Type: PointerRank: 2Lengths: 5 2

Page 25: Not a lot of people know that v2.0 Andy Shiers, COO

No automatic sharing a←'Hello'

– Pocket 1: » Symbol: Name: a, Value: pointer to

– Pocket 2: » Data: Value: Hello

b←'Hello'

– Pocket 3: » Symbol: Name: b, Value: pointer to

– Pocket 4: » Data: Value: Hello

Page 26: Not a lot of people know that v2.0 Andy Shiers, COO

Sharing pockets a←'Hello'

– Pocket 1: » Symbol: Name: a, Value: pointer to

– Pocket 2: » Data: Value: Hello

b←a– Pocket 3:

» Symbol: Name b, Value: pointer to Pocket 2

c←2e6⍴⊂a– Pocket 4:

» Symbol: Name c, Value: pointer to Pocket 5– Pocket 5:

» Data: Value: 2e6 pointers to Pocket 2– c apparently takes up more space than there is in the workspace

Page 27: Not a lot of people know that v2.0 Andy Shiers, COO

Shared pockets can easily stop being shared

c,¨←'a'WS FULL

• Each element has to be generated• Each element is separate from all others

c[2],←'a'• .. ((¯1+2e6)⍴⊂'hello') and 1⍴⊂'helloa'

Page 28: Not a lot of people know that v2.0 Andy Shiers, COO

Some useful system functions

• ⎕SIZE– Reports what the object would take up if no pocket sharing

occurring– Is best used on numeric/character data– Is of little practical use

• ⎕WA– Reports how much free space left in workspace– Is a "heavy" operation

• Forces a compaction• Forces all data to be squeezed where possible

• ⎕DR– Monadic use reports the data type

• Squeezes the data first if possible

Page 29: Not a lot of people know that v2.0 Andy Shiers, COO

Some useful I-Beams• 2000⌶

– 0: A quick ⎕WA• No Compaction, no squeeze, some approximation

– 1: Workspace used• Some approximation of more complex structures

– 2: Number of compactions since last workspace loaded• Keep this as small as possible !• Includes number of calls to WA⎕

• 2002⌶– "⎕WA and a bit"

• Keeps a bit more workspace available• 181⌶

– "⎕DR without the squeeze"• Squeeze is possible if a compaction happens when returning result !

Page 30: Not a lot of people know that v2.0 Andy Shiers, COO

So what about that comment ?'andys'⎕ns'' ⋄ define foo ⋄ foo

Other meta data

Type: FunctionName: fooOther_stuff:

Other meta data

Type: SymbolName: andysValue:

Other meta data

Type: NamespaceName: andysContents:

∇ foo;secret[1] secret←'MySecret'[2] :Trap 0[3] ÷0[4] :EndTrap ∇

Other meta data

Type: SymbolName: secretValue:

Other meta data

Type: CharacterRank: 1 Length: 8Value: MySecret

Other meta data

Type: DM(X)⎕

Page 31: Not a lot of people know that v2.0 Andy Shiers, COO

Delete the namespace)erase andys

Other meta data

Type: FunctionName: fooOther_stuff:

Other meta data

Type: SymbolName: andysValue:

Other meta data

Type: NamespaceName: andysContents:

∇ foo;secret[1] secret←'MySecret'[2] :Trap 0[3] ÷0[4] :EndTrap ∇

Other meta data

Type: SymbolName: secretValue:

Other meta data

Type: CharacterRank: 1 Length: 8Value: MySecret

Other meta data

Type: DM(X)⎕

Page 32: Not a lot of people know that v2.0 Andy Shiers, COO

Clear up: ÷0

Other meta data

Type: FunctionName: fooOther_stuff:

Contents:

Other meta data

∇ foo;secret[1] secret←'MySecret'[2] :Trap 0[3] ÷0[4] :EndTrap ∇

Other meta data

Type: SymbolName: secretValue:

Other meta data

Type: CharacterRank: 1 Length: 8Value: MySecret

Type: Namespace

Other meta data

Type: DM(X)⎕

Other meta data

Type: ÷0 error

Page 33: Not a lot of people know that v2.0 Andy Shiers, COO

Ask yourself• When using 127⌶:

– Have you shared that sensitive data pocket ?– Have you unintentionally shared that sensitive data

pocket?

• When saving a workspace:– Is it worth running )RESET– Is it worth )SAVEing the workspace and then )COPYing it into a CLEAR

WS ?

• When developing code:– What am I hoping to learn by using ⎕SIZE/⎕WA/⎕DR ?– Make use of 2000⌶

Page 34: Not a lot of people know that v2.0 Andy Shiers, COO

34

And that's that !

[email protected]