<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 11/3/2022 11:21 AM, Luciano Notarfrancesco via Cuis-dev wrote:
<blockquote
cite="mid:CAL5GDypaS=cnDoBcEkYiuVhOkS0iN0wb_N2uZDyb2Q3PsPPTJg@mail.gmail.com"
type="cite">
<div dir="auto">Yes, the idea of functional blocks could be very
interesting. But the most straight forward idea of blocks that
don’t modify state at all wouldn’t work, it would be more
complicated than that.</div>
<div dir="auto">For example, the block [:x | x / 2] is a function
for integers and fractions in the sense I was using before, e.g.
evaluating it multiple times at 3 returns always 3/2. But it
modifies object memory and creates new instances of 3/2 each
time (they are equal but not identical).</div>
<div dir="auto">So I think perhaps the notion of “functional
blocks” should be used differently in Smalltalk, not strongly as
in functional languages, but dynamically and in terms of
behavior, similarly as how we deal with types (for example in
methods that assume their arguments implement certain protocols,
but without enforcing types explicitly like other languages).</div>
</blockquote>
<br>
Instead of "without modifying any existing object at all" I'd have
said "without modifying any previously existing object at all". The
idea is to disable modifying older objects, but to allow creating /
modifying new objects, created during the execution of the block.
That would be pretty close to what functional languages do, that is
to allow modification only during creation.<br>
<br>
<blockquote
cite="mid:CAL5GDypaS=cnDoBcEkYiuVhOkS0iN0wb_N2uZDyb2Q3PsPPTJg@mail.gmail.com"
type="cite">
<div dir="auto">Later I’ll write some comments for the methods
that assume the blocks are functions. I should have documented
that more clearly.</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 3 Nov 2022 at 20:28
Juan Vuletich <<a moz-do-not-send="true"
href="mailto:juan@cuis.st">juan@cuis.st</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"> A feature that would
be nice to have is functional blocks. Some way to be
certain that some block will evaluate without modifying
any existing object at all. Then, Smalltalk would be
better as a functional language, and many operations
taking a block would be more natural.<br>
<br>
Just rambling out loud.<br>
<br>
BTW, comments at these methods could be enhanced, possibly
with links to this email thread.<br>
<br>
Cheers,</div>
<div bgcolor="#ffffff" text="#000000"><br>
<br>
</div>
</blockquote>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>