-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharxiv-consent-aware-programming.tex
More file actions
1942 lines (1632 loc) · 77 KB
/
Copy patharxiv-consent-aware-programming.tex
File metadata and controls
1942 lines (1632 loc) · 77 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% SPDX-License-Identifier: MPL-2.0
% SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
%
% Consent-Aware Programming: Embedding Ethical Deliberation, Attribution,
% and Emotional Context in Language Semantics
%
% Target: arXiv preprint (cs.PL / cs.HC cross-list)
\documentclass[11pt,a4paper]{article}
% --- Packages ---
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{mathpartir}
\usepackage{stmaryrd}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{microtype}
\usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,shapes.geometric,calc}
\usepackage{fancyvrb}
\usepackage[margin=1in]{geometry}
% --- Theorem environments ---
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{example}[theorem]{Example}
% --- Listings configuration ---
\definecolor{wokekw}{RGB}{120,50,150}
\definecolor{wokestr}{RGB}{0,120,60}
\definecolor{wokecmt}{RGB}{100,100,100}
\definecolor{wokeann}{RGB}{180,60,30}
\definecolor{codebg}{RGB}{248,248,248}
\lstdefinelanguage{WokeLang}{
morekeywords={to,remember,only,if,okay,thanks,measured,in,data,then,
clean,analyze,feeling,confident,return,true,false,
when,otherwise,for,each,while,match,with,import,from,
module,expose,type,is,has,end,pipeline,step,consent,
revoke,grant,audit,acknowledge},
sensitive=true,
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
moredelim=[s][\color{wokeann}]{@}{)},
}
\lstset{
language=WokeLang,
basicstyle=\small\ttfamily,
keywordstyle=\color{wokekw}\bfseries,
stringstyle=\color{wokestr},
commentstyle=\color{wokecmt}\itshape,
backgroundcolor=\color{codebg},
frame=single,
framerule=0.4pt,
rulecolor=\color{gray!40},
numbers=left,
numberstyle=\tiny\color{gray},
numbersep=8pt,
breaklines=true,
breakatwhitespace=true,
tabsize=2,
showstringspaces=false,
captionpos=b,
xleftmargin=1.5em,
framexleftmargin=1.5em,
aboveskip=1em,
belowskip=0.8em,
}
% --- Semantic notation ---
\newcommand{\sem}[1]{\llbracket #1 \rrbracket}
\newcommand{\eval}{\Downarrow}
\newcommand{\step}{\longrightarrow}
\newcommand{\consent}{\mathsf{consent}}
\newcommand{\granted}{\mathsf{granted}}
\newcommand{\denied}{\mathsf{denied}}
\newcommand{\pending}{\mathsf{pending}}
\newcommand{\unitty}[1]{\langle #1 \rangle}
\newcommand{\feeling}[2]{\mathsf{feel}(#1, #2)}
\newcommand{\attr}[2]{\mathsf{attr}(#1, #2)}
\newcommand{\WokeLang}{\textsc{WokeLang}}
% --- Title ---
\title{%
\textbf{Consent-Aware Programming:}\\[0.3em]
\large Embedding Ethical Deliberation, Attribution, and Emotional Context\\
in Language Semantics%
}
\author{%
Jonathan D.A.\ Jewell\\
\texttt{j.d.a.jewell@open.ac.uk}\\
\texttt{https://github.com/hyperpolymath}%
}
\date{March 2026}
\begin{document}
\maketitle
% ============================================================================
% ABSTRACT
% ============================================================================
\begin{abstract}
Programming languages encode assumptions about what matters.
Most languages assume that what matters is \emph{computation}---the
transformation of inputs to outputs, the allocation and reclamation of
memory, the dispatch of messages between processes. We argue that this
assumption is incomplete. Programs are social artifacts: they are
written by people, for people, within institutional and ethical
contexts that shape their meaning no less than their operational
semantics.
We present \WokeLang{}, a programming language that embeds ethical
deliberation, attribution, and emotional context directly into its
semantics. \WokeLang{} introduces four novel constructs:
\emph{consent gates} (\texttt{only if okay}), which create mandatory
deliberation points around ethically significant operations;
\emph{units of measure} (\texttt{measured in}), which carry
dimensional information as first-class types oriented toward human
communication; \emph{gratitude blocks} (\texttt{thanks to}), which
make contribution attribution an executable, auditable program
construct; and \emph{empathy annotations} (\texttt{@feeling}), which
allow developers to attach confidence and emotional metadata to code.
We provide formal operational semantics for consent gates, describe
the integration of these features into a Hindley-Milner type system
with dimensional analysis, and report on an implementation targeting
WebAssembly via an OCaml frontend and Rust runtime.
Our design philosophy holds that programming languages are
\emph{communication media} between humans, not merely instruction sets
for machines. We draw on values-sensitive design, feminist HCI, and
the philosophy of technology to argue that language designers have both
the opportunity and the responsibility to make ethical deliberation
syntactically cheap and semantically meaningful.
\end{abstract}
\vspace{0.5em}
\noindent\textbf{Keywords:} programming language design, consent,
ethics in computing, human-centered programming, units of measure,
attribution, values-sensitive design, formal semantics
% ============================================================================
% 1. INTRODUCTION
% ============================================================================
\section{Introduction}
\label{sec:introduction}
Every programming language embodies a theory of what programming
\emph{is}. C treats programming as the management of memory and
machine words. Haskell treats it as the composition of mathematical
functions. Erlang treats it as the coordination of isolated,
message-passing processes. These are not merely implementation
choices; they are \emph{ontological commitments} that shape how
programmers think about the systems they build
\citep{sapir1929status,whorf1956language,iverson1980notation}.
What no mainstream language treats programming as is a fundamentally
\emph{social} and \emph{ethical} activity. Yet programs are written by
teams of people with different levels of confidence in their own code.
Programs delete user data, transfer money, make medical decisions, and
deny parole. Programs are built on the unacknowledged labor of open
source maintainers. The social and ethical dimensions of programming
are not peripheral concerns to be addressed by external tooling,
governance frameworks, or codes of conduct bolted onto an amoral
substrate. They are \emph{intrinsic} to the activity of writing
software.
This paper presents \WokeLang{}, a programming language designed
around the premise that ethical deliberation, contribution
attribution, developer confidence, and human readability are
first-class concerns deserving of direct syntactic and semantic
support. \WokeLang{} does not aim to solve ethics by technical
means---a category error we are keen to
avoid~\citep{green2019good,selbst2019fairness}. Rather, it aims to
make the social and ethical texture of programming \emph{visible} in
the source code itself, creating affordances for deliberation where
current languages create affordances for speed.
We make the following contributions:
\begin{enumerate}[leftmargin=*]
\item \textbf{Consent gates} (\S\ref{sec:consent}): a control flow
construct that creates mandatory deliberation points around
ethically weighted operations, with formal operational semantics
that distinguish consent-gated from ungated execution paths.
\item \textbf{Communicative units of measure}
(\S\ref{sec:units}): a dimensional type system integrated with the
consent model, oriented not just toward bug prevention but toward
making programs legible as descriptions of physical and social
reality.
\item \textbf{Gratitude blocks} (\S\ref{sec:gratitude}): an
executable attribution mechanism that creates auditable graphs of
contribution acknowledgment within programs.
\item \textbf{Empathy annotations} (\S\ref{sec:empathy}): a
metadata system for developer confidence and emotional context,
surfaceable by code review tools and static analysis.
\item \textbf{A human-readable design philosophy}
(\S\ref{sec:philosophy}) that treats syntax as a communication
medium between people, informed by values-sensitive design and
feminist HCI.
\item \textbf{Formal semantics and implementation}
(\S\ref{sec:semantics}, \S\ref{sec:implementation}): operational
semantics for the consent gate calculus and a working compiler
targeting WebAssembly.
\end{enumerate}
% ============================================================================
% 2. BACKGROUND
% ============================================================================
\section{Background and Motivation}
\label{sec:background}
\subsection{Programming Languages as Social Artifacts}
The view that programming languages are purely technical artifacts has
been challenged from multiple directions. \citet{knuth1984literate}
argued that programs should be written primarily for human readers.
\citet{gabriel1996patterns} explored the relationship between software
design and the built environment through the lens of Christopher
Alexander's pattern language. More recently, \citet{ko2017past}
surveyed decades of evidence that programming is fundamentally a
\emph{human} activity, shaped by cognitive constraints, social
dynamics, and institutional pressures.
The sociotechnical systems perspective~\citep{trist1981evolution}
insists that technical and social systems are mutually constitutive:
you cannot optimize one without attending to the other. Applied to
programming languages, this means that syntax and semantics are not
neutral conduits for expressing algorithms; they \emph{afford} certain
ways of thinking and \emph{constrain} others. A language without
first-class support for error handling affords ignoring errors. A
language without a concept of ownership affords memory unsafety. We
contend that a language without a concept of consent affords ethical
inattention.
\subsection{Values-Sensitive Design}
Values-sensitive design (VSD) is a theoretically grounded approach to
the design of technology that accounts for human values in a
principled and comprehensive
manner~\citep{friedman1996value,friedman2013value}. VSD identifies
three types of investigation: \emph{conceptual} (what values are at
stake?), \emph{empirical} (how do stakeholders experience the
technology?), and \emph{technical} (how can the technology's
properties support or hinder the identified values?).
Applied to programming language design, VSD asks: what values does a
language's syntax make easy to express? What values does it make
invisible? Most languages make \emph{efficiency}, \emph{correctness},
and \emph{modularity} easy to express. Few make \emph{consent},
\emph{attribution}, or \emph{deliberation} expressible at all.
\subsection{Feminist HCI and Care Ethics}
Feminist HCI~\citep{bardzell2010feminist} offers a lens that
foregrounds \emph{pluralism} (whose experience counts?),
\emph{participation} (who gets to shape the design?),
\emph{embodiment} (how does the technology relate to lived
experience?), and \emph{ecology} (how does it fit into broader systems
of power?). \citet{light2011hci} extends this to consider how design
can ``make space for the expression of values that are currently
marginalized.''
Care ethics~\citep{gilligan1982different,held2006ethics} emphasizes
that moral reasoning is not (only) about abstract principles but about
attending to the concrete needs of others within relationships of
dependency. Software development is shot through with such
relationships: between developers and users, between maintainers and
contributors, between the people who write code and the people
affected by its execution.
\WokeLang{} draws on these traditions to ask: what would a
programming language look like if it were designed with
\emph{care}---not as an afterthought, but as a structuring principle?
\subsection{Prior Work on Human-Centered Language Design}
Several languages have explored aspects of human-centered design.
Inform~7~\citep{nelson2006natural} uses natural language syntax to
make interactive fiction authoring accessible. Scratch~\citep{resnick2009scratch}
uses visual blocks to make programming accessible to children.
F\#~\citep{syme2003units} introduced units of measure to the ML
family. Elm~\citep{czaplicki2012elm} prioritized helpful error
messages. Pyret~\citep{krishnamurthi2019pyret} integrated testing
into the language itself.
None of these languages, however, have attempted to embed
\emph{ethical deliberation} as a semantic concept. \WokeLang{} builds
on their insights while pushing into new territory: the idea that
consent, attribution, and emotional context are as worthy of language
support as types, functions, and modules.
% ============================================================================
% 3. CONSENT GATES
% ============================================================================
\section{Consent Gates}
\label{sec:consent}
\subsection{Motivation}
Consider a function that deletes a user's account and all associated
data. In most programming languages, this function is syntactically
identical to a function that increments a counter. Both are function
calls; both return values; both can be composed with other functions.
Nothing in the language distinguishes an operation that permanently
destroys someone's personal data from one that adds one to an integer.
This is, we argue, a design failure. The two operations have
profoundly different \emph{ethical weights}, and a language that treats
them identically provides no affordance for recognizing this
difference. Developers must rely on comments, naming conventions, or
institutional processes to mark the distinction---all of which are
invisible to the compiler, the type checker, and the runtime.
\WokeLang{} introduces \emph{consent gates} to address this gap. A
consent gate is a control flow construct that creates a mandatory
deliberation point around an ethically significant operation:
\begin{lstlisting}[caption={Consent gate for account deletion}]
to delete_account(user) ->
only if okay "Permanently delete all data for {user.name}?" {
database.drop_user(user.id)
audit_log.record("deletion", user.id)
return "Account deleted"
}
\end{lstlisting}
The \texttt{only if okay} construct is not merely a confirmation
dialog, though it may produce one at runtime. It is a
\emph{semantic marker} that the enclosed code path involves ethical
weight. This distinction has consequences at every level of the
system:
\begin{itemize}[leftmargin=*]
\item \textbf{Compilation:} The compiler tracks consent-gated paths
separately, enabling analyses such as ``what percentage of
destructive operations in this codebase are consent-gated?''
\item \textbf{Type checking:} Functions containing consent gates
have different types from those without, preventing silent
composition of gated and ungated operations.
\item \textbf{Runtime:} The consent mechanism is pluggable---in
interactive contexts it may prompt a human; in batch contexts it
may consult a policy file; in test contexts it may auto-approve.
\item \textbf{Auditing:} Every consent decision (granted or denied)
is logged with timestamps and the consent string, creating an
auditable trail of ethical decision points.
\end{itemize}
\subsection{Consent as Effect}
We model consent as an \emph{effect} in the sense of algebraic
effects~\citep{plotkin2009handlers,bauer2015programming}. A consent
gate introduces the $\consent$ effect, which must be handled by a
consent handler in the calling context.
\begin{definition}[Consent Effect]
\label{def:consent-effect}
The consent effect signature is:
\[
\consent : \mathsf{String} \to \{\granted, \denied\}
\]
A consent gate \texttt{only if okay $s$ \{ $e$ \}} evaluates $e$
only when the handler for $\consent(s)$ returns $\granted$.
\end{definition}
This formulation has several desirable properties. First, consent
effects \emph{compose}: a function that calls another consent-gated
function propagates the consent effect upward, ensuring that the
caller is aware of the ethical weight of the callee. Second, consent
handlers are explicit and auditable: the program must specify how
consent is resolved, whether by user interaction, policy lookup, or
testing mock. Third, the effect system prevents consent from being
silently swallowed: an unhandled consent effect is a type error.
\subsection{Comparison with Capability-Based Security}
Consent gates share a family resemblance with capability-based
security~\citep{dennis1966programming,miller2006robust}, where access
to a resource is mediated by possession of an unforgeable token. In
capability systems, the question is ``does this code have the
\emph{right} to perform this operation?'' In consent-gated systems,
the question is ``has a \emph{deliberation} occurred about whether
this operation should happen?''
The distinction matters. A capability can be granted mechanically: a
policy file says this service may access that database. Consent
requires \emph{engagement}: someone (a user, a reviewer, a governance
process) must consider the specific operation and its consequences.
Consent gates do not replace capability-based security; they
\emph{complement} it by adding a deliberative layer that capabilities
alone cannot provide.
\begin{table}[t]
\centering
\caption{Comparison of access control paradigms}
\label{tab:access-comparison}
\begin{tabular}{@{}lccc@{}}
\toprule
Property & ACLs & Capabilities & Consent Gates \\
\midrule
Mediates access & \checkmark & \checkmark & \checkmark \\
Unforgeable tokens & & \checkmark & \\
Requires deliberation & & & \checkmark \\
Auditable decision trail & Partial & Partial & \checkmark \\
Composable (propagates) & & \checkmark & \checkmark \\
Type-system integrated & & Partial & \checkmark \\
Human-centered framing & & & \checkmark \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Consent Scoping and Revocation}
Consent in \WokeLang{} is scoped and revocable. A consent grant
applies only within the lexical scope of the consent gate:
\begin{lstlisting}[caption={Scoped consent}]
only if okay "Process payment of {amount}?" {
// consent is active here
charge_card(user.card, amount)
}
// consent has expired; cannot call charge_card
\end{lstlisting}
Consent can also be revoked mid-scope using the \texttt{revoke
consent} construct, modeling situations where circumstances change
during an operation. This is formalized as a control flow
exception that unwinds the consent-gated block.
\subsection{Nested Consent and Escalation}
When consent gates nest, the inner gate must independently obtain
consent, even if the outer gate has already been approved. This
models the real-world principle that consenting to one thing does not
imply consenting to everything it entails:
\begin{lstlisting}[caption={Nested consent gates}]
only if okay "Migrate user data to new system?" {
copy_data(user, new_system)
only if okay "Delete original data after migration?" {
delete_original(user, old_system)
}
}
\end{lstlisting}
The user may consent to migration without consenting to deletion.
This nesting is semantically enforced: the compiler rejects attempts
to hoist inner consent gates out of outer ones.
% ============================================================================
% 4. UNITS OF MEASURE
% ============================================================================
\section{Units of Measure}
\label{sec:units}
\subsection{Motivation: Communication, Not Just Safety}
Units of measure in programming languages are typically motivated by
safety: the Mars Climate Orbiter was lost because of a
Newton-seconds versus pound-force-seconds confusion; the Ariane~5
exploded partly due to a conversion error between 64-bit and 16-bit
representations of a physical quantity~\citep{lions1996ariane}. These
are compelling reasons to build dimensional analysis into type systems.
\WokeLang{} shares this safety motivation but extends it with a
\emph{communicative} one. Units of measure are not just constraints
that prevent bugs; they are \emph{documentation} that makes programs
legible as descriptions of physical and social reality. When a
programmer writes:
\begin{lstlisting}[caption={Units as communication}]
remember distance = 42 measured in km
remember time = 3.5 measured in hours
remember speed = distance / time // inferred: km/hours
\end{lstlisting}
the units serve as a form of \emph{self-narration}: the code explains
not just what it computes but what the computation \emph{means} in
physical terms. This aligns with \citeauthor{knuth1984literate}'s
vision of literate programming, extended from prose annotations to the
type system itself.
\subsection{The Dimensional Type System}
\WokeLang{}'s type system extends Hindley-Milner inference with
dimensional analysis following \citet{kennedy1997relational}. Each
numeric type carries an associated \emph{dimension}, which is an
element of the free abelian group generated by base dimensions.
\begin{definition}[Dimensions]
\label{def:dimensions}
Let $\mathcal{B} = \{L, M, T, I, \Theta, N, J, \ldots\}$ be a set of
base dimensions (length, mass, time, current, temperature, amount,
luminous intensity, and user-defined dimensions). A \emph{dimension}
is an element of the free abelian group $\mathbb{Z}^{|\mathcal{B}|}$,
written multiplicatively:
\[
d = L^{a_1} \cdot M^{a_2} \cdot T^{a_3} \cdots
\]
The dimension of a dimensionless quantity is the identity element
$\mathbf{1}$.
\end{definition}
\begin{definition}[Dimensioned Types]
\label{def:dim-types}
A \emph{dimensioned type} is a pair $\unitty{\tau, d}$ where $\tau$
is a numeric type (\texttt{Int}, \texttt{Float}, \texttt{Decimal})
and $d$ is a dimension. The typing rules for arithmetic operations
respect dimensional algebra:
\begin{mathpar}
\inferrule{
\Gamma \vdash e_1 : \unitty{\tau, d_1} \\
\Gamma \vdash e_2 : \unitty{\tau, d_2}
}{
\Gamma \vdash e_1 + e_2 : \unitty{\tau, d_1}
}\;\text{if } d_1 = d_2
\and
\inferrule{
\Gamma \vdash e_1 : \unitty{\tau, d_1} \\
\Gamma \vdash e_2 : \unitty{\tau, d_2}
}{
\Gamma \vdash e_1 \times e_2 : \unitty{\tau, d_1 \cdot d_2}
}
\and
\inferrule{
\Gamma \vdash e_1 : \unitty{\tau, d_1} \\
\Gamma \vdash e_2 : \unitty{\tau, d_2}
}{
\Gamma \vdash e_1 \div e_2 : \unitty{\tau, d_1 \cdot d_2^{-1}}
}
\end{mathpar}
\end{definition}
\subsection{User-Defined Dimensions}
Beyond SI base units, \WokeLang{} allows user-defined dimensions for
domain-specific quantities:
\begin{lstlisting}[caption={User-defined dimensions}]
type Currency is dimension
type UserCount is dimension
remember revenue = 50000 measured in Currency
remember users = 1200 measured in UserCount
remember arpu = revenue / users // Currency/UserCount
\end{lstlisting}
This is particularly useful in domains where informal ``units'' are
pervasive but rarely tracked: dollars per user, requests per second,
students per classroom. Making these units explicit turns tribal
knowledge into type-checked documentation.
\subsection{Integration with Consent Gates}
The dimensional type system interacts with consent gates in a subtle
way. Certain unit conversions may themselves be consent-gated,
particularly when the conversion involves a loss of precision or a
change of meaning:
\begin{lstlisting}[caption={Consent-gated conversion}]
remember precise_value = 3.14159265 measured in radians
// Lossy conversion requires consent
only if okay "Convert to degrees (loses precision)?" {
remember approx = precise_value as degrees
}
\end{lstlisting}
This models the real-world principle that unit conversions are not
always innocent: converting between coordinate systems, currency
denominations, or medical units can introduce errors that have ethical
consequences.
% ============================================================================
% 5. GRATITUDE BLOCKS
% ============================================================================
\section{Gratitude Blocks}
\label{sec:gratitude}
\subsection{The Attribution Problem}
Open source software depends on the unpaid labor of maintainers whose
contributions are systematically
undervalued~\citep{eghbal2020working}. Attribution in current
practice is handled through comments, \texttt{CONTRIBUTORS} files,
commit histories, and social conventions---none of which are visible
to the compiler, queryable at runtime, or auditable by automated
tools.
\WokeLang{} introduces \emph{gratitude blocks} to make attribution a
first-class, executable construct:
\begin{lstlisting}[caption={Gratitude block}]
thanks to {
"Alice Chen" -> "Designed the consent protocol"
"Bob Martinez" -> "Fixed the race condition in gate resolution"
"Fatima Al-Rashid" -> "Reviewed the formal semantics"
}
to resolve_consent(gate) ->
// implementation that benefited from all three contributions
...
\end{lstlisting}
\subsection{Semantics of Gratitude}
A gratitude block is not a comment. It is a program construct with
runtime semantics: when a gratitude block is evaluated, it emits
\emph{attribution events} that are recorded in the program's
attribution graph.
\begin{definition}[Attribution Graph]
\label{def:attr-graph}
The attribution graph $G = (V, E)$ is a directed graph where:
\begin{itemize}
\item Vertices $V = V_P \cup V_C$ are partitioned into
\emph{person vertices} $V_P$ (contributors) and \emph{code
vertices} $V_C$ (modules, functions, blocks).
\item Edges $E \subseteq V_P \times V_C \times \Sigma^*$ are
labeled with attribution descriptions.
\end{itemize}
The graph is accumulated during program execution and can be queried
at any point via the standard library:
\end{definition}
\begin{lstlisting}[caption={Querying the attribution graph}]
remember contributors = attribution.query("resolve_consent")
for each person in contributors {
say("{person.name}: {person.contribution}")
}
\end{lstlisting}
\subsection{Attribution Propagation}
When a function $f$ calls a function $g$ that contains a gratitude
block, the attribution edges from $g$ are transitively visible from
$f$. This models the reality that when you use a library, you
benefit from the work of its contributors even if you never see their
names:
\begin{lstlisting}[caption={Transitive attribution}]
// In module authentication.woke
thanks to { "Priya Sharma" -> "Implemented TOTP" }
to verify_totp(code, secret) -> ...
// In module login.woke
to login(user, code) ->
// Priya's contribution is transitively attributed
if verify_totp(code, user.secret) { ... }
// Query: attribution.transitive("login") includes Priya
\end{lstlisting}
\subsection{Social and Institutional Implications}
The attribution graph has implications beyond individual programs.
Organizations can aggregate attribution data across projects to
understand contribution patterns, identify unacknowledged labor, and
make invisible work visible. Package managers can surface attribution
information alongside dependency trees, so that \texttt{install
http-server} also shows you who built the foundations you depend on.
This is, explicitly, a \emph{political} design choice. We believe
that programming languages should make it easy to acknowledge the work
of others, not because acknowledgment is technically necessary (the
code runs either way) but because it is \emph{ethically necessary} in
a field that systematically undervalues maintenance, documentation,
and invisible labor~\citep{star1999ethnography,eghbal2020working}.
% ============================================================================
% 6. EMPATHY ANNOTATIONS
% ============================================================================
\section{Empathy Annotations}
\label{sec:empathy}
\subsection{The Confidence Gap}
Code review is a social process~\citep{rigby2013convergent}.
Reviewers attempt to understand not just \emph{what} the code does but
\emph{how confident the author is} in their implementation. This
confidence information is typically conveyed through social signals:
the tone of the pull request description, the number of ``TODO''
comments, the developer's reputation, informal conversations. None of
this is captured in the code itself.
\WokeLang{} introduces \emph{empathy annotations}, a metadata system
that allows developers to attach confidence and emotional context
directly to code:
\begin{lstlisting}[caption={Empathy annotations}]
@feeling(confident=true)
to add(a, b) -> a + b
@feeling(confident=false, note="Edge case handling is fragile")
to parse_date(input) ->
// I think this handles leap years correctly...
...
@feeling(anxious=true, note="First time writing concurrent code")
to worker_pool(size) ->
...
\end{lstlisting}
\subsection{Annotation Semantics}
Empathy annotations are structured metadata, not free-form comments.
They have a defined schema:
\begin{lstlisting}[caption={Empathy annotation schema}]
type Feeling is {
confident: Boolean // author's confidence in correctness
anxious: Boolean // author's anxiety about the code
experimental: Boolean // this is exploratory/prototype code
needs_review: Boolean // explicitly requesting review
note: String // free-form context
}
\end{lstlisting}
Because the schema is fixed, empathy annotations are \emph{queryable}
by tooling. A code review tool can:
\begin{itemize}[leftmargin=*]
\item Surface all functions marked \texttt{confident=false} for
priority review.
\item Highlight code marked \texttt{anxious=true} with additional
context about the author's concerns.
\item Track the ratio of confident to unconfident code as a project
health metric.
\item Generate reports showing where uncertainty concentrates in the
codebase.
\end{itemize}
\subsection{Making the Implicit Explicit}
The design of empathy annotations is motivated by a simple
observation: developers already have feelings about their code. They
already know which functions are solid and which are held together with
hope and string. But this knowledge is locked in their heads, shared
only through informal channels that disappear when the developer
leaves the project.
By making this knowledge explicit and structured, empathy annotations
create what \citet{star1999ethnography} calls
\emph{infrastructure}---the boring, invisible substrate that makes
coordination possible. The annotation \texttt{@feeling(confident=%
false)} is a tiny act of vulnerability that enables a more honest,
more efficient review process.
\subsection{Potential for Misuse}
We acknowledge the potential for empathy annotations to be misused.
An employer might penalize developers who mark code as unconfident. A
culture of toxic positivity might pressure developers to mark
everything as confident. These are real risks, and they are not
solvable by technical means alone.
Our position is that the \emph{option} to express uncertainty is
better than the absence of that option. A language that provides no
way to say ``I am not sure about this'' is not neutral; it implicitly
demands confidence, or at least the performance of confidence.
\WokeLang{} provides the affordance; institutional and cultural
practices must ensure it is used well. We discuss this further in
\S\ref{sec:discussion}.
% ============================================================================
% 7. THE HUMAN-READABLE DESIGN PHILOSOPHY
% ============================================================================
\section{The Human-Readable Design Philosophy}
\label{sec:philosophy}
\subsection{Language as Communication Medium}
\WokeLang{}'s syntax is designed to read like prose. This is not a
superficial aesthetic choice; it reflects a specific theory of what
programming languages \emph{are}.
Most programming language design treats syntax as a notation for
expressing computations to a machine, optimized for precision and
conciseness. This is a reasonable design goal, but it is not the only
one. \WokeLang{} treats syntax as a \emph{communication medium}
between humans, optimized for readability, clarity, and the expression
of intent.
\begin{lstlisting}[caption={Human-readable syntax examples}]
// Function definition reads as English prose
to calculate_shipping(weight, destination) ->
remember base_cost = 5.99 measured in USD
remember per_kg = 2.50 measured in USD/kg
return base_cost + (weight * per_kg)
// Pipelines read left to right
remember result = raw_data
then validate
then normalize
then analyze
// Pattern matching reads as case analysis
match user.role with
when "admin" -> grant_full_access(user)
when "moderator" -> grant_mod_access(user)
otherwise -> grant_read_access(user)
\end{lstlisting}
\subsection{Design Principles}
The human-readable design philosophy is guided by several principles:
\paragraph{Principle 1: Keywords as Verbs.}
Where most languages use symbols (\texttt{=>}, \texttt{|>},
\texttt{::}), \WokeLang{} prefers English words (\texttt{then},
\texttt{when}, \texttt{measured in}). This slightly increases
verbosity in exchange for dramatically increased readability for
non-experts and for future maintainers encountering the code for the
first time.
\paragraph{Principle 2: Declarations as Statements of Intent.}
\texttt{remember x = 5} is more evocative than \texttt{let x = 5} or
\texttt{var x = 5}. The word ``remember'' frames variable binding
not as a machine operation (allocating a slot) but as a cognitive act
(committing a fact to memory). The word \texttt{to} before function
definitions frames the function as a \emph{purpose}: ``to add $a$ and
$b$'' rather than ``function add.''
\paragraph{Principle 3: Pipelines as Narratives.}
The \texttt{then} keyword creates data pipelines that read as
narratives: ``take the raw data, \emph{then} validate it, \emph{then}
normalize it, \emph{then} analyze it.'' This mirrors how humans
describe processes in everyday language, reducing the cognitive
distance between a natural-language description and its implementation.
\paragraph{Principle 4: Consent as Conversation.}
The \texttt{only if okay} construct frames potentially destructive
operations as conversations between the program and its operator.
This is deliberate: the phrasing invites the reader to imagine the
ethical deliberation that should accompany the operation.
\subsection{Readability as Ethical Choice}
We argue that readability is not merely a convenience but an
\emph{ethical} property of programming languages. Code that is
difficult to read is code that is difficult to review, difficult to
audit, and difficult to hold accountable. Obscure code concentrates
power in the hands of those who can decode it. Readable code
distributes power more broadly, enabling more people to participate in
the scrutiny and governance of software systems.
This position is informed by \citet{nissenbaum2004privacy}'s concept
of \emph{contextual integrity}: the ethical assessment of a technology
depends not just on what it does but on how it fits into existing
social contexts and norms. A programming language that is legible
only to specialists creates a context in which software governance is
delegated to specialists. A language that is legible to a broader
audience creates a context in which governance can be more broadly
shared.
% ============================================================================
% 8. FORMAL SEMANTICS
% ============================================================================
\section{Formal Semantics}
\label{sec:semantics}
We now provide operational semantics for the consent gate calculus,
which is the most technically novel aspect of \WokeLang{}'s design.
\subsection{Syntax}
We define a core calculus $\lambda_{\consent}$ that extends the simply
typed lambda calculus with consent gates:
\begin{definition}[Syntax of $\lambda_{\consent}$]
\label{def:syntax}
\begin{align*}
e ::=\; & x \mid \lambda x:\tau.\, e \mid e_1\; e_2 \mid n \mid
e_1 + e_2 \mid \\
& \mathbf{only\_if\_okay}\; s\; e \mid
\mathbf{consent\_handler}\; h\; e \mid \\
& \mathbf{attr}\; p\; d\; e \mid
\mathbf{feel}\; f\; e \\[0.5em]
v ::=\; & \lambda x:\tau.\, e \mid n \mid
\mathbf{granted} \mid \mathbf{denied} \\[0.5em]
\tau ::=\; & \mathsf{Int} \mid \mathsf{String} \mid
\mathsf{Bool} \mid \tau_1 \to \tau_2 \mid
\unitty{\tau, d} \mid \\
& \mathsf{Consent}[\tau] \\[0.5em]
h ::=\; & \mathsf{interactive} \mid
\mathsf{policy}(P) \mid
\mathsf{auto}(\granted) \mid
\mathsf{auto}(\denied)
\end{align*}
\end{definition}
The key new forms are $\mathbf{only\_if\_okay}\; s\; e$, which
creates a consent gate with prompt string $s$ guarding expression $e$;
and $\mathbf{consent\_handler}\; h\; e$, which installs a consent
handler $h$ for the duration of $e$.
\subsection{Typing Rules}
\begin{definition}[Typing for consent gates]
\label{def:consent-typing}
We extend the typing judgment $\Gamma; \Sigma \vdash e : \tau$ with a
consent context $\Sigma$ that tracks whether we are inside a consent
handler.
\begin{mathpar}
\inferrule[\textsc{T-Consent}]{
\Gamma; \Sigma \vdash e : \tau \\
s : \mathsf{String}
}{
\Gamma; \Sigma \vdash
\mathbf{only\_if\_okay}\; s\; e : \mathsf{Consent}[\tau]
}
\and
\inferrule[\textsc{T-Handler}]{
\Gamma; \Sigma, h \vdash e : \tau
}{
\Gamma; \Sigma \vdash
\mathbf{consent\_handler}\; h\; e : \tau
}
\and
\inferrule[\textsc{T-Attr}]{
\Gamma; \Sigma \vdash e : \tau \\
p : \mathsf{String} \\
d : \mathsf{String}
}{
\Gamma; \Sigma \vdash
\mathbf{attr}\; p\; d\; e : \tau
}
\and
\inferrule[\textsc{T-Feel}]{
\Gamma; \Sigma \vdash e : \tau \\
f : \mathsf{Feeling}
}{
\Gamma; \Sigma \vdash
\mathbf{feel}\; f\; e : \tau
}
\end{mathpar}
\end{definition}
The type $\mathsf{Consent}[\tau]$ wraps the result type to indicate
that the value may not be available (if consent is denied). This
forces callers to handle the possibility of denial.
\subsection{Operational Semantics}
\begin{definition}[Small-step semantics for consent gates]
\label{def:consent-opsem}
We define the reduction relation $\langle e, H, A \rangle \step
\langle e', H', A' \rangle$ where $H$ is the consent handler stack
and $A$ is the attribution accumulator.
\begin{mathpar}
\inferrule[\textsc{E-ConsentGranted}]{
H = h :: H' \\
h(s) = \granted
}{
\langle \mathbf{only\_if\_okay}\; s\; e,\; H,\; A \rangle
\step
\langle e,\; H,\; A \cdot \mathsf{log}(\granted, s, t) \rangle
}
\and
\inferrule[\textsc{E-ConsentDenied}]{
H = h :: H' \\
h(s) = \denied
}{
\langle \mathbf{only\_if\_okay}\; s\; e,\; H,\; A \rangle
\step
\langle \denied,\; H,\; A \cdot \mathsf{log}(\denied, s, t) \rangle
}
\and
\inferrule[\textsc{E-Handler}]{
\langle e,\; h :: H,\; A \rangle \step
\langle e',\; h :: H,\; A' \rangle
}{
\langle \mathbf{consent\_handler}\; h\; e,\; H,\; A \rangle
\step
\langle \mathbf{consent\_handler}\; h\; e',\; H,\; A' \rangle
}