forked from olabini/ioke
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjava_ideas
66 lines (40 loc) · 1.6 KB
/
java_ideas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
For private methods, do the same thing so it's obvious that they are private:
private void doSomethingEvil();
will give
private:doSomethingEvil
this works for setters and getters too:
private String getSomething();
private void setSomething(String something);
will give
private:something
private:something=
protected and public methods should probably just be open, to make it easy.
To figure out:
- args by name functionality?
- how to send code to Java methods?
maybe something like this:
Thread new(Runnable: callSomeExpensiveThing)
Thread new(run: callSomeExpensiveThing)
Collections sort(list, fn(x, y, x <=> y))
Collections sort(list, compareTo: (x, y, x <=> y))
- add loads of good helpers to Java types
Code:
all interfaces and classes are activatable, so you can create a new simple implementatino of Comparable by calling it:
Comparable(x, y, y <=> x)
Comparable(
compareTo: fn(x,y, x<=>y),
equals: fn(other, other == 1)
)
keyword arguments will use the paranamer approach
-----
Send in code to methods that take interfaces ... three variations:
one:
if we see a parenthesis with more than one argument, we know it's a code argument to coerce into an interface or abstract class:
addActionListener((e, e source text = "blarg"))
two:
a method or lexical block can always be coerced into an interface:
addActionListener(fn(e, e source text = "Blarg"))
three:
activating a java class/interface
addActionListener(ActionListener(e, e source text = "Blarg"))
addActionListener(ActionListener(onEvent: fn(e, e source text = "Blarg")))