Slides I prepared for the 29 January 2014 Ecma TC39 meeting, on Value Objects in JS, an ES7 proposal -- this one shotgunned the roadmap-space of declarative syntax, to find the right amount per TC39 (nearly zero, turns out).
My Fluent 2014 keynote slides, without demos (Intel SIMD, BananaBread with Boon/FreeDOOM inside, Epic Games Unreal Tournament on UE3, Epic Games Soul on UE4).
My Fluent 2014 keynote slides, without demos (Intel SIMD, BananaBread with Boon/FreeDOOM inside, Epic Games Unreal Tournament on UE3, Epic Games Soul on UE4).
This is going to be a discussion about design patterns. But I promise it’s going to be very different from the Gang of Four patterns that we all have used and loved in Java.
It doesn’t have any mathematics or category theory - it’s about developing an insight that lets u identify code structures that u think may be improved with a beautiful transformation of an algebraic pattern.
In earlier days of Java coding we used to feel proud when we could locate a piece of code that could be transformed into an abstract factory and the factory bean could be injected using Spring DI. The result was we ended up maintaining not only Java code, but quite a bit of XML too, untyped and unsafe. This was the DI pattern in full glory. In this session we will discuss patterns that don’t look like external artifacts, they are part of the language, they have some mathematical foundations in the sense that they have an algebra that actually compose and compose organically to evolve larger abstractions.
Algebraic Thinking for Evolution of Pure Functional Domain ModelsDebasish Ghosh
The focus of the talk is to emphasize the importance of algebraic thinking when designing pure functional domain models. The talk begins with the definition of an algebra as consisting of a carrier type, a set of operations/functions and a set of laws on those operations. Using examples from the standard library, the talk shows how thinking of abstractions in terms of its algebra is more intuitive than discussing its operational semantics. The talk also discusses the virtues of parametricity and compositionality in designing proper algebras.
Algebras are compositional and help build larger algebras out of smaller ones. We start with base level types available in standard libraries and compose larger programs out of them. We take a real life use case for a domain model and illustrate how we can define the entire model using the power of algebraic composition of the various types. We talk about how to model side-effects as pure abstractions using algebraic effects. At no point we will talk about implementations.
At the end of the talk we will have a working model built completely out of the underlying algebra of the domain language.
Special Edition with Dr. Robin Bloor
Live Webcast September 9, 2015
Watch the Archive: https://bloorgroup.webex.com/bloorgroup/onstage/g.php?MTID=e8b9ac35d8e4ffa3452562c1d4286a975
Do the math: algebra will transform information management. Just as the relational database revolutionized the information landscape, so will a just-released, complete algebra of data overhaul the industry itself. So says Dr. Robin Bloor in his new book, the Algebra of Data, which he’ll outline in this special one-hour webcast.
Once organizations learn how to express their data sets algebraically, the benefits will be significant and far-reaching. Data quality problems will slowly subside; queries will run orders of magnitude faster; integration challenges will fade; and countless tedious jobs in the data management space will bid their farewell. But first, software companies must evolve, and that will take time.
Visit InsideAnalysis.com for more information.
CONSTRUCTOR AND DESTRUCTOR PPT BASED ON OOP SUBJECT ......FULLY CONCEPT EXPLAINED WITH SAMPLE PROGRAM IN IT .....FOR MORE SLIDES PLEASE FOLLOW ME ..... THANK YOU
Constructors, Destructors, call in parameterized Constructor, Multiple constructor in a class, Explicit/implicit call, Copy constructor, Dynamic Constructors and call in parameterized Constructor
My Mozilla Research Party talk on the occasion of Mozilla's public 15th anniversary, with some material from an invited talk I gave at MSR Paris in spring 2011.
This is going to be a discussion about design patterns. But I promise it’s going to be very different from the Gang of Four patterns that we all have used and loved in Java.
It doesn’t have any mathematics or category theory - it’s about developing an insight that lets u identify code structures that u think may be improved with a beautiful transformation of an algebraic pattern.
In earlier days of Java coding we used to feel proud when we could locate a piece of code that could be transformed into an abstract factory and the factory bean could be injected using Spring DI. The result was we ended up maintaining not only Java code, but quite a bit of XML too, untyped and unsafe. This was the DI pattern in full glory. In this session we will discuss patterns that don’t look like external artifacts, they are part of the language, they have some mathematical foundations in the sense that they have an algebra that actually compose and compose organically to evolve larger abstractions.
Algebraic Thinking for Evolution of Pure Functional Domain ModelsDebasish Ghosh
The focus of the talk is to emphasize the importance of algebraic thinking when designing pure functional domain models. The talk begins with the definition of an algebra as consisting of a carrier type, a set of operations/functions and a set of laws on those operations. Using examples from the standard library, the talk shows how thinking of abstractions in terms of its algebra is more intuitive than discussing its operational semantics. The talk also discusses the virtues of parametricity and compositionality in designing proper algebras.
Algebras are compositional and help build larger algebras out of smaller ones. We start with base level types available in standard libraries and compose larger programs out of them. We take a real life use case for a domain model and illustrate how we can define the entire model using the power of algebraic composition of the various types. We talk about how to model side-effects as pure abstractions using algebraic effects. At no point we will talk about implementations.
At the end of the talk we will have a working model built completely out of the underlying algebra of the domain language.
Special Edition with Dr. Robin Bloor
Live Webcast September 9, 2015
Watch the Archive: https://bloorgroup.webex.com/bloorgroup/onstage/g.php?MTID=e8b9ac35d8e4ffa3452562c1d4286a975
Do the math: algebra will transform information management. Just as the relational database revolutionized the information landscape, so will a just-released, complete algebra of data overhaul the industry itself. So says Dr. Robin Bloor in his new book, the Algebra of Data, which he’ll outline in this special one-hour webcast.
Once organizations learn how to express their data sets algebraically, the benefits will be significant and far-reaching. Data quality problems will slowly subside; queries will run orders of magnitude faster; integration challenges will fade; and countless tedious jobs in the data management space will bid their farewell. But first, software companies must evolve, and that will take time.
Visit InsideAnalysis.com for more information.
CONSTRUCTOR AND DESTRUCTOR PPT BASED ON OOP SUBJECT ......FULLY CONCEPT EXPLAINED WITH SAMPLE PROGRAM IN IT .....FOR MORE SLIDES PLEASE FOLLOW ME ..... THANK YOU
Constructors, Destructors, call in parameterized Constructor, Multiple constructor in a class, Explicit/implicit call, Copy constructor, Dynamic Constructors and call in parameterized Constructor
My Mozilla Research Party talk on the occasion of Mozilla's public 15th anniversary, with some material from an invited talk I gave at MSR Paris in spring 2011.
Value objects express “‘what’ something is rather than ‘who’ or ‘which’ it is.” In other words, values lack identity.
For example, the number 10 or the color red - all instances of 10 are conceptually equal to all other instances of 10, and likewise, red is always red. Two red bikes, however, have distinct identities.
We’ll explore how extracting value objects can simplify the challenge of bringing the real-world to bear as software. Then, we’ll touch on some strategies for integrating value objects with everyone’s favorite ORM, ActiveRecord.
My JSConf.eu presentation. Some recycling from CapitolJS, but new stuff in the middle on ES6 special forms triangle, monocle-mustache, classes (syntax in progress), and how the JS community can help.
My bonus #txjs talk, on paren-free (not in ES.next yet but now backward compatible), also the for-in (same old) and for-of (over values including iterators) loops.
Keynote presented at DevWeek (24th March 2015)
Trees. Both beautiful and useful. But we’re not talking about the green, oxygen-providing ones. As abstract structures we see trees all over the place – file systems, class hierarchies, ordered data structures, etc. They are neat and tidy, nested and hierarchical – a simple way of organising things; a simple way of breaking large things down into small things.
The problem is, though, that there are many things – from modest fragments of code up to enterprise-wide IT systems – that do not comfortably fit into this way of looking at the world and organising it. Software architecture, design patterns, class decomposition, performance, unit tests... all of these cut across the strict hierarchy of trees. This keynote will look at what this means for how we think and design systems, whether large or small.
"JavaScript in 2016" by Eduard Tomàs
Some years ago in a far far away company, Brendan Eich created JavaScript. A lot of things happened since then. Times changed, the web grown, the language itself was updated, and we as a developers need to adapt too. Last year the last standard of the language arose: ECMAScript 2015 is here, and has some new and interesting features. In this talk we will show the most relevant ones, and also we will introduce some interesting patterns that you can use in JavaScript: you'll learn how to master the language and made JavaScript your best ally to conquest the world!
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...GeeksLab Odessa
SubScript - это расширение языка Scala, добавляющее поддержку конструкций и синтаксиса аглебры общающихся процессов (Algebra of Communicating Processes, ACP). SubScript является перспективным расширением, применимым как для разработки высоконагруженных параллельных систем, так и для простых персональных приложений.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/ILvHbv.
Brendan Eich surveys interesting developments in the Web platform, analysing emergent trends, and making some predictions. Filmed at qconsf.com.
Brendan Eich is CTO and SVP of Engineering for Mozilla, and widely recognized for his enduring contributions to the Internet revolution. In 1995, Eich invented JavaScript (ECMAScript), the Internet’s most widely used programming language. He co-founded the mozilla.org project in 1998, serving as chief architect, and has been a board member of the Mozilla Foundation since its inception in 2003.
Pointer
Features of Pointers
Pointer Declaration
Pointer to Class
Pointer Object
The this Pointer
Pointer to Derived Classes and Base Class
Binding Polymorphisms and Virtual Functions
Introduction
Binding in C++
Virtual Functions
Rules for Virtual Function
Virtual Destructor
What's new with C++ since, oh, before the dot-com bubble? Learn more in this Lunch and Learn, with a refresher of C++ basics, C++/CLI for C# developers, and the new features of C++11/14 and possibly C++17.
The Present and The Future of Functional Programming in C++Alexander Granin
Keynote talk for C++ Siberia 2019.
I'm speaking about why Functional Programming is important in C++ world, what is the philosophy of FP in C++, and what features do we have. I'm presenting a connection of constexpr and template metaprogramming to pure FP, and talking about why monads are inevitable. I'm also discussing an upcoming features in C++.
Debugging and Profiling C++ Template MetaprogramsPlatonov Sergey
Template metaprogramming is an emerging new direction in C++ programming for executing algorithms in compilation time. Despite all of its already proven benefits and numerous successful applications, it is yet to be accepted in industrial projects. One reason is the lack of professional software tools supporting the development of template metaprograms. A strong analogue exists between traditional runtime programs and compile-time metaprograms. This connection presents the possibility for creating development tools similar to those already used when writing runtime programs. This paper introduces Templight, a debugging framework that reveals the steps executed by the compiler during the compilation of C++ programs with templates. Templight’s features include following the instantiation chain, setting breakpoints, and inspecting metaprogram information. This framework aims to take a step forward to help template metaprogramming become more accepted in the software industry.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
2. Caveats & Pleas
• A review & update from July 2013 TC39 meeting
• I’m looking for big picture and detailed feedback
• The big picture matters most at this stage
• There will be some TypeScript syntax/semantics!
• Please hold your fire, illustrative & concrete but
could be changed based on other ES7 work
• These slides are dense, please feel free to ask Qs
• Not done yet, open issues & imperfections below
5. Preserving Boolean Algebra
•
!= and ! are not overloadable, to preserve
identities including
•
•
•
•
X ? A : B
<=>
!X ? B : A
!(X && Y)
<=>
!X || !Y!
!(X || Y)
<=>
!X && !Y
X != Y
<=>
!(X == Y)
6. Preserving Relational Relations
•
> and >= are derived from < and <= as
follows:
•
•
A > B
<=>
B < A
A >= B
<=>
B <= A
• We provide <= in addition to < rather than
derive A <= B from !(B < A) in order to
allow the <= overloading to match the same
value object’s == semantics -- and for special
cases, e.g., unordered values (NaNs)
7. Strict Equality Operators
• The strict equality operators, === and !==,
cannot be overloaded
• They work on frozen-by-definition value
objects via a structural recursive strict
equality test (beware, NaN !== NaN)
• Same-object-reference remains a fast-path
optimization
8. Why Not Double Dispatch?
• Left-first asymmetry (v value, n number):
•
•
v + n
==>
v.add(n)
n + v
==>
v.radd(n)!
• Anti-modular: exhaustive other-operand type
enumeration required in operator method
bodies
• Consequent loss of compositionality:
complex and rational cannot be
composed to make ratplex without
modifying source or wrapping in proxies
9. Cacheable Multimethods
• Proposed in 2009 by Christian Plesner Hansen
(Google) in es-discuss
• Avoids double-dispatch drawbacks from last slide:
binary operators implemented by 2-ary functions
for each pair of types
• Supports Polymorphic Inline Cache (PIC)
optimizations (Christian was on the V8 team)
• Background reading: [Chambers 1992]
10. Binary Operator Example
• For v + u with either a value object: !
• Let p = v.[[Get]](@@ADD)
• If p is not a Set, throw a TypeError
• Let q = u.[[Get]](@@ADD_R)
• If q is not a Set, throw a TypeError
• Let r = p intersect q
• If r.size != 1 throw a TypeError
• Let f = r[0]; if f is not a function, throw
• Evaluate f(v, u) and return the result
11. API Idea from CPH 2009
// NOTE: NOT PROPOSED FOR ES7
!
function addPointAndNumber(a, b) {
return Point(a.x + b, a.y + b);
}
!
Function.defineOperator('+', addPointAndNumber, Point, Number);
!
function addNumberAndPoint(a, b) {
return Point(a + b.x, a + b.y);
}
!
Function.defineOperator('+', addNumberAndPoint, Number, Point);
!
function addPoints(a, b) {
return Point(a.x + b.x, a.y + b.y);
}
!
Function.defineOperator('+', addPoints, Point, Point);
12. Literal Syntax
•
•
•
•
•
int64(0)
==>
0L // as in C#!
uint64(0)
==> 0UL // as in C#!
float32(0) ==>
0f // as in C#!
bignum(0)
0n // avoid i/I!
==>
decimal(0) ==>
0m // or M, C/F#!
• We want a syntax extension mechanism, with
declarative not runtime API
• This means new syntax for operator function
and suffix definition
13. Value Class Declaration
value class point2d {
// no suffix
// default typeof “point2d” (no overriding/spoofing)
!
constructor(private x: int32, private y: int32) {
// implicit Object.freeze(this) on return
}
!
// binary operators (note arrow shorthand for { return … })
point2d + number (a, b) => point2d(a.x + b, a.y);
number + point2d (a, b) => point2d(a + b.x, b.y);
point2d + point2d (a, b) => point2d(a.x + b.x, a.y + b.y);
!
point2d - number (a, b) => point2d(a.x - b, a.y);
number - point2d (a, b) => point2d(a - b.x, b.y);
point2d - point2d (a, b) => point2d(a.x - b.x, a.y - b.y);
!
// more operators with private access elided
}
14. Value Class Declaration, cont.
value class pixel { // CSS unit, 1/96th of an inch
suffix “px”;
typeof “CSS:pixel”; // we allow a lot, but overriding throws
!
constructor pixel(public twips: int32) {
// implicit Object.freeze(this) on return
}
!
// unary operators (note arrow shorthand for { return … })
+() => pixel(this.twips);
-() => pixel(-this.twips);
!!() => !!this.twips;
~() => pixel(~this.twips);
}
!
value class point { // CSS unit, not Cartesian plane point!
suffix “pt”;
typeof “CSS:point”;
// constructor and unary operators not shown…
}
15. Binary Operator Declaration
value operators {
// Here number, string, boolean are in scope, and new operator
// syntax common to value class works.
!
pixel + number (a, b)
number + pixel (a, b)
pixel + pixel (a, b)
pixel + point (a, b)
point + pixel (a, b)
=>
=>
=>
=>
=>
pixel(a.twips + b * 15);
pixel(a * 15 + b.twips);
pixel(a.twips + b.twips);
pixel(a.twips + b.twips * 20);
pixel(a.twips * 20 + b.twips);
pixel - number (a, b)
number - pixel (a, b)
pixel - pixel (a, b)
pixel - point (a, b)
point - pixel (a, b)
=>
=>
=>
=>
=>
pixel(a.twips - b * 15);
pixel(a * 15 - b.twips);
pixel(a.twips - b.twips);
pixel(a.twips - b.twips * 20);
pixel(a.twips * 20 - b.twips);
!
!
// etc… (note only public class members)
}
16. Value Subclasses
value class point2d {
constructor point2d(public x: int32, public y: int32) {
// implicit Object.freeze(this) on return EXCEPT via super
}
// call this function f:
point2d + point2d (a, b) => point2d(a.x + b.x, a.y + b.y);
}
!
value class point3d extends point2d {
constructor point3d(x: int32, y: int32, public z: int32) {
super(x, y);
// implicit Object.freeze(this) on return once, here
}
// call this function g:
point3d + point3d (a, b) => point3d(a.x+b.x, a.y+b.y, a.z+b.z);
}
!
// What does point3d(1, 0, 0) + point3d(0, 1, 0) do?
{f, g} intersect {f, g} => {f, g}, ambiguity error!
17. Class Precedence via Prototype Depth
// When point2d’s declaration is evaluated:
let f = point2d + point2d (a, b) => point2d(a.x + b.x, a.y + b.y);
point2d.prototype.@@ADD = Set([[1, f]]);
point2d.prototype.@@ADD_R = Set([[1, f]]);
!
// When point3d’s declaration is evaluated:
let g = point3d+point3d (a,b) => point3d(a.x+b.x,a.y+b.y,a.z+b.z);
point3d.prototype.@@ADD = Set([[1, f], [2, g]]);
point3d.prototype.@@ADD_R = Set([[1, f], [2, g]]);
!
// Set notation, please! Here’s what we have at this moment:
point2d.prototype.@@ADD: {[1, f]}
point2d.prototype.@@ADD_R: {[1, f]}
point3d.prototype.@@ADD: {[1, f], [2, g]}
point3d.prototype.@@ADD_R: {[1, f], [2, g]}
!
// What does point3d(1, 0, 0) + point3d(0, 1, 0) do?
{[1,f], [2,g]} intersect {[1,f], [2,g]} => g, more specific wins
18. The (Other) Frame Problem
// P1: Primitives, e.g. strings, are wrapped via the corresponding
// scoped constructor/converter function, e.g. String.
String.prototype.len = function () { return this.length; }
!
// Suppose otherFrame.str is “LOL”, the primitive string value:
alert(otherFrame.str.len()); // 3
!
// Value objects are objects, that’s the price of extensibility.
int64.prototype.digits = function () { … }
!
alert(otherFrame.int64(42).digits()) // throws, method missing
!
// P2: As noted last time, cross-frame/realm binary ops fail:
let three = 1L + otherFrame.int64(2); // throws, no such method
!
//
//
//
//
Possible solutions:
1. Live with it, frames/realms (should be) more isolated FTW
2. Proxy as if across a membrane, isolation with mediation FTW
3. Memoize aggressively (hash-cons); solves P2, not P1 in full
19. Healing the Old Wounds
// Primitives: built-in magic, not extensible, auto-wrap via scope
// Reference Objects: user-extensible, conversions not operators
// Value Objects: by-value semantics; multimethod dyadic operator,
//
unary operator, suffix, and typeof extensibility
!
// Idea: enable the JS hacker to bless primitives as value objects
// and thereby opt into value object operator semantics.
!
value
value
value
value
class
class
class
class
null;
boolean;
number;
string;
//
//
//
//
typeof null == “null”
false != "", true != 1
42 != "42", 1 != true
"" != false, “42" != 42, [] + “" throws
!
// ‘value class string;’ will require explicit .toString() calls!
!
use value sanity;
// all of the above, a shorthand; no way to
// “undeclare”; upgrade your Realm!