Top Banner
What can Perl learn from Rebol ?
86

What we can learn from Rebol?

May 10, 2015

Download

Technology

lichtkind

Aout philosophy and features of Rebol and how get some of the interesting inside of Perl. Held at YAPC::EU 2010 in Pisa.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What we can learn from Rebol?

What can Perl learn from Rebol ?

Page 2: What we can learn from Rebol?

No Rebol Course

Page 3: What we can learn from Rebol?

some hobby philosophy

Page 4: What we can learn from Rebol?

Perl Philosophy

TIMTOWTDI

simple and possible

context sensitive

Page 5: What we can learn from Rebol?

Philosophy

TIMTOWTDI

simple and possible

context sensitive

Page 6: What we can learn from Rebol?

Quote

Take a dash of PERL, mix with the crossplatform compatibilty of a Java, and make it

extremely easy for beginners to start coding, andyou get the general idea.

Page 7: What we can learn from Rebol?

A Hobby Philosopher

Page 8: What we can learn from Rebol?

„Real“ Philosopher

Page 9: What we can learn from Rebol?

Carl Sassenrath

Page 10: What we can learn from Rebol?

Carl Sassenrath

- Apple, HP and Commodore

Page 11: What we can learn from Rebol?

Carl Sassenrath

- Apple, HP and Commodore

- Pantaray, American Multimedia, Videostream

Page 12: What we can learn from Rebol?

Carl Sassenrath

- Apple, HP and Commodore

- Pantaray, American Multimedia, Videostream

- REBOL Technologies

Page 13: What we can learn from Rebol?

Carl Sassenrath

- Amiga OS, IOS, VisCorp ED

- CDTV

- Amiga Logo, Next Gen. Forth, Rebol

Page 14: What we can learn from Rebol?

- Distribution

Page 15: What we can learn from Rebol?

- Browser

Page 16: What we can learn from Rebol?

Left Click : Start Rebol App

Page 17: What we can learn from Rebol?

Left Click : Start Rebol App

Page 18: What we can learn from Rebol?

Rebol App

Page 19: What we can learn from Rebol?

Rebol App

Page 20: What we can learn from Rebol?

Rebol App

Page 21: What we can learn from Rebol?

Rebol App

Page 22: What we can learn from Rebol?

- Browser

Page 23: What we can learn from Rebol?

Right Click : Get Meta Data

Page 24: What we can learn from Rebol?

Rebol Editor

Page 25: What we can learn from Rebol?

- Browser

Page 26: What we can learn from Rebol?

Rebol Shell

Page 27: What we can learn from Rebol?

Carl Sassenrath

- Amiga OS, IOS, VisCorp ED

- CDTV

- Amiga Logo, Next Gen. Forth, Rebol

Page 28: What we can learn from Rebol?

Carl Sassenrath

- Amiga OS, IOS, VisCorp ED

- CDTV

- Amiga Logo, Next Gen. Forth, Rebol

Page 29: What we can learn from Rebol?
Page 30: What we can learn from Rebol?

● Lisp, Forth, Logo and Self

Page 31: What we can learn from Rebol?

● Lisp, Forth, Logo and Self

● Lightweight Distributed Computing

Page 32: What we can learn from Rebol?

● Lisp, Forth, Logo and Self

● Lightweight Distributed Computing

● programming-in-the-small (PITS)

Page 33: What we can learn from Rebol?

PITS:

~ 800kB binary 1.8 MB for distribution

Libs Tools SamplesDocs Links

Page 34: What we can learn from Rebol?

PITS:

Remote Editor: 53Daytime Server Deamon: 61

bmp2png ConverterTCP Port Scanner: 98Simple Clock App: 106

Minimal Email Client: 130Simple Picture Viewer: 132

Page 35: What we can learn from Rebol?

PITS:

Remote Editor: 53Daytime Server Deamon: 61

bmp2png ConverterTCP Port Scanner: 98Simple Clock App: 106

Minimal Email Client: 130Simple Picture Viewer: 132

Page 36: What we can learn from Rebol?

PITS:

view layout [ f: field btn"Edit"[editor to-url f/text]]

Page 37: What we can learn from Rebol?

● Lisp, Forth, Logo and Self

● Lightweight Distributed Computing

● programming-in-the-small (PITS)

Page 38: What we can learn from Rebol?

● Lisp, Forth, Logo and Self

● Lightweight Distributed Computing

● fighting software complexety

Page 39: What we can learn from Rebol?

● Lisp, Forth, Logo and Self

● Lightweight Distributed Computing

● fighting software complexety

Page 40: What we can learn from Rebol?
Page 41: What we can learn from Rebol?

Silent Scream: Rebel with a cause

Page 42: What we can learn from Rebol?

Relative Expression-Based Object Language

Page 43: What we can learn from Rebol?

Relative Expression-Based Object Language

eval that like REBOL does:

back to front

Page 44: What we can learn from Rebol?

Relative Expression-Based Object Language

the obvious, don't argue with that

Page 45: What we can learn from Rebol?

Relative Expression-Based Object Language

sounds like OOP ?

Page 46: What we can learn from Rebol?

Relative Expression-Based Object Language

● no OOP like Ruby or Perl 6

Page 47: What we can learn from Rebol?

Relative Expression-Based Object Language

● no OOP like Ruby or Perl 6

● Object means here just „thing“

Page 48: What we can learn from Rebol?

Relative Expression-Based Object Language

That brings no meaning anyway :)

There are same principles it's based on

Page 49: What we can learn from Rebol?

Relative Expression-Based Object Language

Sounds like a functional language ?

Page 50: What we can learn from Rebol?

Relative Expression-Based Object Language

(not pure) functional (since 2.0)

Page 51: What we can learn from Rebol?

Relative Expression-Based Object Language

Page 52: What we can learn from Rebol?

Relative Expression-Based Object Language

● Thats's the main message

Page 53: What we can learn from Rebol?

Relative Expression-Based Object Language

● Thats's the main message

● That's how Rebol syntax works

Page 54: What we can learn from Rebol?

Relative Expression-Based Object Language

● Thats's the main message

● That's how Rebol syntax works

● In Perl we call that context sensitive

Page 55: What we can learn from Rebol?

Relative Expression-Based Object Language

read http://www.perl.org/learn.html

read %info.txt

Page 56: What we can learn from Rebol?

Rebol Perl 5

read http://www.perl.org/learn.html use LWP::Simple;

get("http://www.perl.org/learn.html");

text: read %info.txt use File::Slurp; my $text = slurp( 'info.txt' ) ;

Page 57: What we can learn from Rebol?

Rebol Perl 6

read http://www.perl.org/learn.html use HTTP::Client;

HTTP::Client.new.get("http://www.perl.org/learn.html");

text: read %info.txt my $text = slurp( 'info.txt' ) ;

Page 58: What we can learn from Rebol?

welcome to the strange land

Page 59: What we can learn from Rebol?

shock therapy

Page 60: What we can learn from Rebol?

, forget all you know

no variablesno hashes

no precedence table (2 + 3 * 2 == 10)no builtins

no Subroutinensometimes scopes

no name spaces (befor Rebol 3)no Regex (parse)

Page 61: What we can learn from Rebol?

All is gone?

Page 62: What we can learn from Rebol?

You have to know 4 concepts

Page 63: What we can learn from Rebol?

4 Terms

words:

data types:

series:

refinements:

Page 64: What we can learn from Rebol?

4 Terms

words: typeless data container

data types:

series:

refinements:

Page 65: What we can learn from Rebol?

4 Terms

words: variables, routines, buildins

data types:

series:

refinements:

Page 66: What we can learn from Rebol?

4 Terms

words: variables, routines, buildins

data types: integer, string, char, tuple, pair, block,

series:

refinements:

Page 67: What we can learn from Rebol?

4 Terms

words: variables, routines, buildins

data types: integer, string, char, tuple, pair, block,money, file, url, email, tag, binary, date, time, issue

series:

refinements:

Page 68: What we can learn from Rebol?

4 Terms

words: variables, routines, buildins

data types: integer, string, char, tuple, pair, block,money, file, url, email, tag, binary, date, time, issue

series:

refinements:

Page 69: What we can learn from Rebol?

4 Terms

words: variables, routines, buildins

data types: integer, string, char, tuple, pair, block,money, file, url, email, tag, binary, date, time, issue

series: lists, hashes, code

refinements:

Page 70: What we can learn from Rebol?

4 Terms

words: variables, routines, buildins

data types: integer, string, char, tuple, pair, block,money, file, url, email, tag, binary, date, time, issue

series: lists, hashes, code

refinements: (@ / %) slices / return value

Page 71: What we can learn from Rebol?

Perl Rebol# => ;

{} => [] $var = => var:$var => :var

eval $var => var $var[3] => var/3

$var{'sub'} => var/sub sub() => sub

sub($p,$m) => sub p m

Page 72: What we can learn from Rebol?

Perl Rebol

$a++ a: a + 1

Page 73: What we can learn from Rebol?

Perl Rebol

$a = 30 * 3.1415 / 180 sin($a) / cos($a) tangent 30

sin($a) / cos($a) tangent/radians 30

use Math::Trig; tan(deg2rad(30));

Page 74: What we can learn from Rebol?

Perl 6 Rebol

loop => foreverall, any none @a => all, any []

prompt => ask slurp => read

no break in switchPair als nativer Typ

grammars, heavy usage of MMD

Page 75: What we can learn from Rebol?

Meta Data

REBOL [Title:Date:

Version:...

]

Page 76: What we can learn from Rebol?

Meta Data

File: Author: Email: Web: Rights: Requires:

Purpose: { }, Comment: { }, Notes: { }

History: [0.1.1 12-Oct-2008 "add to ... path"

Library: [ ...

Page 77: What we can learn from Rebol?

DSL for GUI

view layout [ text :rise_time

button "Quit" #"q" [quit]]

Page 78: What we can learn from Rebol?

in Perluse Tkx;

Tkx::button(".b", -text => "Hello, world", -command => sub { Tkx::destroy(".") },);

Tkx::pack(".b");

Tkx::MainLoop();

Page 79: What we can learn from Rebol?

in Perluse Prima qw(Application Button);

New Prima::MainWindow( text => "Hello, world", size => [ 200, 200] ,)-> insert( Button => centered => 1, text => "Hello, world", onClick => sub { $::application->close } ,);

run Prima;

Page 80: What we can learn from Rebol?

RebGUI

view layout [ text :rise_time

button "Quit" #"q" [quit]]

Page 81: What we can learn from Rebol?

DSL for Regex

expr: [term ["+" | "-"] expr | term] term: [factor ["*" | "/"] term | factor]

factor: [primary "**" factor | primary] primary: [some digit | "(" expr ")"]

digit: charset "0123456789"

probe parse "1 + 2 * ( 3 - 2 ) / 4" expr== true

Page 82: What we can learn from Rebol?

DSL for Regex

parse read http://www.gaisma.com/en/location/halle.html [ thru <td class="sunshine"><i> copy rise_time to </i> ]

Page 83: What we can learn from Rebol?

Functional DSL

does

func

function

Page 84: What we can learn from Rebol?

DSL for OOP

make

Page 85: What we can learn from Rebol?

Rebol 3

Open Source

Unicode

Debug Hooks

Better GUI Objects

Page 86: What we can learn from Rebol?

Ideas

Io::All

Perlapi

Modules

Prima