On 21/12/2019 23:59:27, Chris Angelico wrote:
On Sun, Dec 22, 2019 at 10:46 AM Greg Ewing wrote:
On 22/12/19 9:04 am, Soni L. wrote:
switch (op) {
[...]
case OP_TAILCALL: {
adjust_regs();
some_other_stuff();
/* fallthrough */
}
case OP_CALL: {
It's not a matter of paradigm in this case precisely, all the proposed
refactoring are not specific to oop:
- replace switch cases by polymorphism (polymorphism also in functional
paradigm)
- replace nested conditionnals by functions with guard clauses (not
specially oop)
- regroup function
On Dec 21, 2019, at 15:59, Chris Angelico wrote:
>
> It's not just about performance. It's also about expressing a concept.
> A tail call IS a call, and the correct way to write this is to do
> stuff, and then do whatever a call does.
Looking at languages that try to express similar semantics
On 2019-12-21 5:22 p.m., Chris Angelico wrote:
On Sun, Dec 22, 2019 at 7:06 AM Soni L. wrote:
> On 2019-12-21 4:52 p.m., Chris Angelico wrote:
> > I'm not sure I understand what switch construct would translate into
> > this style. Can you show an example of code in some other language,
> >
On 2019-12-21 5:52 p.m., Kyle Stanley wrote:
> Python is not an OOP language. If you want to breathe and preach
OOP, you should quite frankly just use Java.
Python isn't *strictly* or *exclusively* an object-oriented
programming language, but since it does have strong support for OOP
On Sun, Dec 22, 2019 at 10:46 AM Greg Ewing wrote:
>
> On 22/12/19 9:04 am, Soni L. wrote:
>
> > switch (op) {
> >[...]
> >case OP_TAILCALL: {
> > adjust_regs();
> > some_other_stuff();
> > /* fallthrough */
> >}
> >case OP_CALL: {
> > make_the_call_happen();
>
On 22/12/19 9:04 am, Soni L. wrote:
switch (op) {
[...]
case OP_TAILCALL: {
adjust_regs();
some_other_stuff();
/* fallthrough */
}
case OP_CALL: {
make_the_call_happen();
break;
}
}
Relying on fall-through in a switch is a micro-optimisation that
may
> Python is not an OOP language. If you want to breathe and preach OOP, you
should quite frankly just use Java.
Python isn't *strictly* or *exclusively* an object-oriented programming
language, but since it does have strong support for OOP features, saying
that "Python is not an OOP language"
On 2019-12-21 20:09, Soni L. wrote:
On 2019-12-21 4:58 p.m., Gregory Salvan wrote:
Years ago there was an interesting movement called anti-if campaign,
now it's more promotional, but the concept of "anti if" may help you
find ways to remove the cases where your suggest "and if" and "or if"
On Sun, Dec 22, 2019 at 7:06 AM Soni L. wrote:
> On 2019-12-21 4:52 p.m., Chris Angelico wrote:
> > I'm not sure I understand what switch construct would translate into
> > this style. Can you show an example of code in some other language,
> > how you'd translate that same logic into today's
On 2019-12-21 4:58 p.m., Gregory Salvan wrote:
Years ago there was an interesting movement called anti-if campaign,
now it's more promotional, but the concept of "anti if" may help you
find ways to remove the cases where your suggest "and if" and "or if"
can apply.
This article is
On 2019-12-21 4:52 p.m., Chris Angelico wrote:
On Sun, Dec 22, 2019 at 6:35 AM Soni L. wrote:
>
>
>
> On 2019-12-21 4:15 p.m., Andrew Barnert wrote:
> > > On Dec 21, 2019, at 08:41, Soni L. wrote:
> > >
> > > I'd like to see the ability to do:
> > >
> > > if x:
> > > 1
> > > and if y:
> > >
Years ago there was an interesting movement called anti-if campaign, now
it's more promotional, but the concept of "anti if" may help you find ways
to remove the cases where your suggest "and if" and "or if" can apply.
This article is particularly well written:
On Sun, Dec 22, 2019 at 6:35 AM Soni L. wrote:
>
>
>
> On 2019-12-21 4:15 p.m., Andrew Barnert wrote:
> > > On Dec 21, 2019, at 08:41, Soni L. wrote:
> > >
> > > I'd like to see the ability to do:
> > >
> > > if x:
> > > 1
> > > and if y:
> > > 2
> > > or if z:
> > > 3
> > >
> > > The truth
On 2019-12-21 4:15 p.m., Andrew Barnert wrote:
> On Dec 21, 2019, at 08:41, Soni L. wrote:
>
> I'd like to see the ability to do:
>
> if x:
> 1
> and if y:
> 2
> or if z:
> 3
>
> The truth table for these would be:
>
> x | y | z | result
> 0 | _ | 0 | (none)
> 0 | _ | 1 | 3
> 1 | 0 |
> On Dec 21, 2019, at 08:41, Soni L. wrote:
>
> I'd like to see the ability to do:
>
> if x:
> 1
> and if y:
> 2
> or if z:
> 3
>
> The truth table for these would be:
>
> x | y | z | result
> 0 | _ | 0 | (none)
> 0 | _ | 1 | 3
> 1 | 0 | _ | 1,3
> 1 | 1 | _ | 1,2,3
>
> and each statement
Could you give an example of some real code that would be improved by this
construct?
> On 21 Dec 2019, at 17:42, Soni L. wrote:
>
> I'd like to see the ability to do:
>
> if x:
> 1
> and if y:
> 2
> or if z:
> 3
>
> The truth table for these would be:
>
> x | y | z | result
> 0 | _
17 matches
Mail list logo