poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bpf.pk: defun _print ?


From: Jose E. Marchesi
Subject: Re: bpf.pk: defun _print ?
Date: Sun, 07 Jun 2020 15:48:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

    Quoting http://www.jemarch.net/pokology-20200504.html :
    
       "the functions defined in struct types are all executed as part
        of the mapper/constructor and, at that time, there is no struct
        value yet to pass to the method"
    
    So there is no point in defining _print as a function. You want to
    have it as a method, so that it can be invoked on a completed struct
    object. Right?

Yeah.  I forgot to update that pickle when I introduced methods.
    
    Proposed patch is attached.

OK for master.
Thanks!
    
    >From 637d8ef0da2d1f87fcb22405871e8989154c26cc Mon Sep 17 00:00:00 2001
    From: Bruno Haible <bruno@clisp.org>
    Date: Sat, 6 Jun 2020 20:58:47 +0200
    Subject: [PATCH] pickles: Define _print correctly.
    
    * pickles/bpf.pk: Define _print as a method, not as a function.
    ---
     pickles/bpf.pk | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/pickles/bpf.pk b/pickles/bpf.pk
    index 4003bca..de119c5 100644
    --- a/pickles/bpf.pk
    +++ b/pickles/bpf.pk
    @@ -133,7 +133,7 @@ deftype BPF_Reg =
       {
        uint<4> code;
     
    -   defun _print = void:
    +   method _print = void:
        {
         print "#<";
         if (code < BPF_R9)
    @@ -155,7 +155,7 @@ deftype BPF_Insn_Opcode =
             BPF_Insn_Source src;
             BPF_Insn_Class class : bpf_class_is_alujmp (class);
     
    -        defun _print = void:
    +        method _print = void:
               {
                print "#<";
                if (class in [BPF_INSN_CLASS_ALU, BPF_INSN_CLASS_ALU64])
    @@ -172,7 +172,7 @@ deftype BPF_Insn_Opcode =
             BPF_Insn_Data_Size size;
             BPF_Insn_Class class;
     
    -        defun _print = void:
    +        method _print = void:
               {
                print "#<";
                if (class == BPF_INSN_CLASS_LDX)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]