Interpolation in Julia
Constructing strings using concatenation can become a bit cumbersome ... Julia allows interpolation into string literals using $, as in Perl:
This is more readable and convenient and equivalent to the above string concatenation – the system rewrites this apparent single string literal into a concatenation of string literals with variables.
The shortest complete expression after the $ is taken as the expression whose value is to be interpolated into the string. Thus, you can interpolate any expression into a string using parentheses:
#Julia
Constructing strings using concatenation can become a bit cumbersome ... Julia allows interpolation into string literals using $, as in Perl:
julia> "$greet, $whom.\n"
"Hello, world.\n"
This is more readable and convenient and equivalent to the above string concatenation – the system rewrites this apparent single string literal into a concatenation of string literals with variables.
The shortest complete expression after the $ is taken as the expression whose value is to be interpolated into the string. Thus, you can interpolate any expression into a string using parentheses:
julia> "1 + 2 = $(1 + 2)"
"1 + 2 = 3"
#Julia
Mixin
- is a class that contains methods for use by other classes without having to be the parent class of those other classes. A mixin can also be viewed as an interface with implemented methods.
• are "included" rather than "inherited"
• encourage code reuse
• are used to avoid the inheritance ambiguity that multiple inheritance can cause (e.g. The diamond problem)
- is a class that contains methods for use by other classes without having to be the parent class of those other classes. A mixin can also be viewed as an interface with implemented methods.
• are "included" rather than "inherited"
• encourage code reuse
• are used to avoid the inheritance ambiguity that multiple inheritance can cause (e.g. The diamond problem)
The diamond problem
- is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and C have overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C?
For example, in the context of GUI software development, a class Button may inherit from both classes Rectangle (for appearance) and Clickable (for functionality/input handling), and classes Rectangle and Clickable both inherit from the Object class. Now if the equals method is called for a Button object and there is no such method in the Button class but there is an overridden equals method in Rectangle or Clickable (or both), which method should be eventually called?
How different languages deal with it:
• Common #Lisp: by order "...in the order in which parent classes are named in the subclass definition"
• Curl: "and the secondary constructor will be invoked for all other subclasses."
• Eiffel: "Eiffel will automatically join features together, if they have the same name and implementation."
• Go: compile-time error
• #Java: compile-time error
• #OCaml: by order "...are inherited in the same order, with each newly inherited method overriding any existing methods."
• #Perl: by order "...from as an ordered list. The compiler uses the first method it finds..."
• #Python: by order
• #Ruby: by order "...as rightmost depth first resolution."
• #Scala: by order "allows multiple instantiation of traits, which allows for multiple inheritance by adding a distinction between the class hierarchy and the trait hierarchy. A class can only inherit from a single class, but can mix-in as many traits as desired." This approach is the most similar to #Nile's; traits being qualifications.
• Tcl: by order "the order of specification in the class declaration affects the name resolution for members..."
Languages that allow only single inheritance, where a class can only derive from one base class, do not have the diamond problem.
Moreover, languages such as #Ada, Objective-C, #CSharp, #Delphi/Free #Pascal, Java, #Swift and PHP allow multiple-inheritance of interfaces (called protocols in Objective-C and Swift). Interfaces are like abstract base classes that specify method signatures without implementing any behavior.
When several interfaces declare the same method signature, as soon as that method is implemented (defined) anywhere in the inheritance chain, it overrides any implementation of that method in the chain above it (in its superclasses). Hence, at any given level in the inheritance chain, there can be at most one implementation of any method. Thus, single-inheritance method implementation does not exhibit the Diamond Problem even with multiple-inheritance of interfaces.
- is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and C have overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C?
For example, in the context of GUI software development, a class Button may inherit from both classes Rectangle (for appearance) and Clickable (for functionality/input handling), and classes Rectangle and Clickable both inherit from the Object class. Now if the equals method is called for a Button object and there is no such method in the Button class but there is an overridden equals method in Rectangle or Clickable (or both), which method should be eventually called?
How different languages deal with it:
• Common #Lisp: by order "...in the order in which parent classes are named in the subclass definition"
• Curl: "and the secondary constructor will be invoked for all other subclasses."
• Eiffel: "Eiffel will automatically join features together, if they have the same name and implementation."
• Go: compile-time error
• #Java: compile-time error
• #OCaml: by order "...are inherited in the same order, with each newly inherited method overriding any existing methods."
• #Perl: by order "...from as an ordered list. The compiler uses the first method it finds..."
• #Python: by order
• #Ruby: by order "...as rightmost depth first resolution."
• #Scala: by order "allows multiple instantiation of traits, which allows for multiple inheritance by adding a distinction between the class hierarchy and the trait hierarchy. A class can only inherit from a single class, but can mix-in as many traits as desired." This approach is the most similar to #Nile's; traits being qualifications.
• Tcl: by order "the order of specification in the class declaration affects the name resolution for members..."
Languages that allow only single inheritance, where a class can only derive from one base class, do not have the diamond problem.
Moreover, languages such as #Ada, Objective-C, #CSharp, #Delphi/Free #Pascal, Java, #Swift and PHP allow multiple-inheritance of interfaces (called protocols in Objective-C and Swift). Interfaces are like abstract base classes that specify method signatures without implementing any behavior.
When several interfaces declare the same method signature, as soon as that method is implemented (defined) anywhere in the inheritance chain, it overrides any implementation of that method in the chain above it (in its superclasses). Hence, at any given level in the inheritance chain, there can be at most one implementation of any method. Thus, single-inheritance method implementation does not exhibit the Diamond Problem even with multiple-inheritance of interfaces.
Language design tips
It should be either so versatile or so feature-rich that it does not need inline code execution of another language.
It should be either so versatile or so feature-rich that it does not need inline code execution of another language.
ComputerScientist
Language design tips Keep it DRY
Sex life tips
Keep it WET
Keep it WET
Do you ever look at your past projects and realize just how much they suck?
#Citron is 92.5% C and 0.6% C++ “There is one single C++ module!”
— #TheSemicolon, according to Github
— #TheSemicolon, according to Github
#TalkingSemicolon
To use all/any, you need to construct a new iterator. You can override their behavior:
#Python
To use all/any, you need to construct a new iterator. You can override their behavior:
def __and__(self, other): return Falsewhich also affects
all.#Python
#TalkingSemicolon
Tools for natural language generation
Either Keras/TensorFlow if going with #Python or TorchNN if going with #Lua.
Nothing else really works.
Tools for natural language generation
Either Keras/TensorFlow if going with #Python or TorchNN if going with #Lua.
Nothing else really works.
#TalkingSemicolon
How to insert GUI
One first makes a core logic, then connects a GUI to it, not the other way around.
GUIs are only methods for displaying things; if your GUI controls your logic, your program model is plain wrong.
Your core has to have support for actions made possible in the GUI, if you make the core based on the UI, it will be pure shit.
How to insert GUI
One first makes a core logic, then connects a GUI to it, not the other way around.
GUIs are only methods for displaying things; if your GUI controls your logic, your program model is plain wrong.
Your core has to have support for actions made possible in the GUI, if you make the core based on the UI, it will be pure shit.
#TalkingSemicolon
Was Smalltalk an inspiration for Citron's syntax?
Yes, it was.
Was it more?
It was much more than the syntax. The idea of a dynamic dispatch system with pure OO, came from Smalltalk
Have you reinvented or refined Smalltalk?
Not really, Citron is quite different, it has different thoughts behind it, it tried to do things very differently.
#Citron #Smalltalk
Was Smalltalk an inspiration for Citron's syntax?
Yes, it was.
Was it more?
It was much more than the syntax. The idea of a dynamic dispatch system with pure OO, came from Smalltalk
Have you reinvented or refined Smalltalk?
Not really, Citron is quite different, it has different thoughts behind it, it tried to do things very differently.
#Citron #Smalltalk
#TalkingSemicolon
#Citron
condition ifTrue: consequence
There's also an ifFalse:, because why waste time not'ing a boolean?#Citron
Nile's object-oriented philosophy is a combination of class-based and prototype-based programming; it is both and neither.
Class-based
There are classes but there is no inter-class inheritance.
Prototype-based
Classes are themselves objects, but there is no delegation; overriding behavior is done explicitly upon qualifications.
Class-based
There are classes but there is no inter-class inheritance.
Prototype-based
Classes are themselves objects, but there is no delegation; overriding behavior is done explicitly upon qualifications.
“You don't have to make a functionality for every nice terminology.”
— #TheSemicolon
— #TheSemicolon
Swing versus AWT
Every Swing lightweight interface ultimately exists within an AWT heavyweight component because all of the top-level components in Swing (JApplet, JDialog, JFrame, and JWindow) extend an AWT top-level container.
AWT components
• are heavyweight
• are implemented by platform-specific code.
• are rendered and controlled by a native peer component specific to the underlying windowing system.
Swing components
• are lightweight
• are written entirely in Java and therefore are platform-independent.
• do not require allocation of native resources in the OS's windowing toolkit.
• Rendering is provided by Java 2D.
• More powerful and flexible
• More components such as tabbed panel, scroll panes, trees, tables, and lists.
• Customizable look and feel
After Java 6, both Swing and AWT components can co-exist in one GUI without Z-order issues.
#Java
“Fuck both of them, and fuck Java on top of it. But if you must, of course, Swing.”
— #TheSemicolon
Every Swing lightweight interface ultimately exists within an AWT heavyweight component because all of the top-level components in Swing (JApplet, JDialog, JFrame, and JWindow) extend an AWT top-level container.
AWT components
• are heavyweight
• are implemented by platform-specific code.
• are rendered and controlled by a native peer component specific to the underlying windowing system.
Swing components
• are lightweight
• are written entirely in Java and therefore are platform-independent.
• do not require allocation of native resources in the OS's windowing toolkit.
• Rendering is provided by Java 2D.
• More powerful and flexible
• More components such as tabbed panel, scroll panes, trees, tables, and lists.
• Customizable look and feel
After Java 6, both Swing and AWT components can co-exist in one GUI without Z-order issues.
#Java
“Fuck both of them, and fuck Java on top of it. But if you must, of course, Swing.”
— #TheSemicolon
Complement qualifications
A set of qualifications is defined as the universal set. This means that the children of this universalSet have to be qualifed for at least or exactly one of them.
A set of qualifications is defined as the universal set. This means that the children of this universalSet have to be qualifed for at least or exactly one of them.