[Groonga-commit] groonga/groonga at 5df7b51 [master] mruby: put an argument in a line

Back to archive index

YUKI Hiroshi yuki****@clear*****
Mon Oct 7 10:43:56 JST 2013


なるほど、そういう事であれば納得です。
Mozillaのjs-ctypesでも、Cの関数をJSの関数にバインドする際に、呼び出し規
約や戻り値の型を指定する引数があった後で、それ以降のすべての引数がその関
数に実際に渡される引数を表す、といった書き方があったので、それと同じ事な
のかなあ、とコメントした後で思っておりました。

Kouhei Sutou wrote:
> In <52520C1D.2030802 �� clear-code.com>
>    "Re: [Groonga-commit] groonga/groonga �� 5df7b51 [master] mruby: put an argument in a line" on Mon, 07 Oct 2013 10:19:25 +0900,
>    YUKI Hiroshi <yuki �� clear-code.com> wrote:
> 
>>
>>   >     mruby: put an argument in a line
>>   >
>>   >     Because other arugments are in each line.
>>   >
>>
>> とのことですが、
>>
>>   >     mrb_sis = mrb_funcall(mrb, mrb_obj_value(ctx->impl->mrb.module),
>> "build", 4,
>>
>> この部分も各行に分けた方がよいという事にならないでしょうか?
> 
> うーん、個人的には
> 
>    mrb_sis = mrb_funcall(mrb,
>                          mrb_obj_value(ctx->impl->mrb.module), "build", 4,
> 
> までならわけてもいいかなぁと思います。
> 
> というのは、
> 
>    mrb_obj_value(ctx->impl->mrb.module),
>    "build",
>    4,
> 
> の引数はひとまとまりなんですよ。
> 「mrb_obj_value(ctx->impl->mrb.module)」オブジェクトの
> 「"build"」メソッドを
> 「4」つの引数で呼びます。
> みたいな意味です。↑でメソッド呼び出しの情報を表現しているの
> でできるだけまとめてあげたいなぁというのがあります。
> 
> で、それ以降は具体的な引数で、ひとつにまとめられるほど短くも
> ないので
> 
>    mrb_cptr_value(mrb, expr),
>    mrb_cptr_value(mrb, n), mrb_fixnum_value(op),
>    mrb_fixnum_value(size));
> 
> よりは
> 
>    mrb_cptr_value(mrb, expr),
>    mrb_cptr_value(mrb, n),
>    mrb_fixnum_value(op),
>    mrb_fixnum_value(size));
> 
> が統一感があっていいなぁと思いました。
> 
> 
> ということで、引数の中でも同じ分類のものはひとかたまりにして
> あげたいのでそこはわけたくないなぁという感じです。
> 
> 似たようなのだと文字列のアドレスと長さを渡す
> 
>    string_ptr, string_len
> 
> みたいなやつも、できればひとまとまりにしたい(同じ行に入れて
> あげたい)です。
> 
>> Kouhei Sutou wrote:
>>> Author
>>>      Kouhei Sutou <kou �� clear-code.com>
>>> Date
>>>      2013-10-06 10:58:11 +0900 (Sun, 06 Oct 2013)
>>> New Revision
>>>      5df7b514671c912fb0007c2b1740e08e8f295aea
>>>      <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea>
>>> Message
>>>
>>>      mruby: put an argument in a line
>>>
>>>      Because other arugments are in each line.
>>>
>>> Modified files
>>>
>>>        * lib/mrb/mrb_expr.c
>>>          <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#diff-0>
>>>
>>>     Modified: lib/mrb/mrb_expr.c (+2 -1)
>>> ===================================================================
>>>
>>> ...  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L358>
>>> 359  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L359>
>>> 360  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L360>
>>> 361  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L361>
>>> 362  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L362>
>>>
>>>
>>> 363  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L363>
>>> 364  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L364>
>>> 365  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0L365>
>>>
>>> 	
>>>
>>> ...  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R358>
>>> 359  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R359>
>>> 360  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R360>
>>> 361  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R361>
>>>
>>> 362  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R362>
>>> 363  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R363>
>>> 364  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R364>
>>> 365  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R365>
>>> 366  <https://github.com/groonga/groonga/commit/5df7b514671c912fb0007c2b1740e08e8f295aea#L0R366>
>>>
>>> 	
>>>
>>> @@ -359,7 +359,8 @@grn_mrb_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
>>>
>>>      mrb_sis = mrb_funcall(mrb, mrb_obj_value(ctx->impl->mrb.module), "build", 4,
>>>                            mrb_cptr_value(mrb, expr),
>>> -                        mrb_cptr_value(mrb, n), mrb_fixnum_value(op),
>>> +                        mrb_cptr_value(mrb, n),
>>> +                        mrb_fixnum_value(op),
>>>                            mrb_fixnum_value(size));
>>>      sis = mrb_cptr(mrb_sis);
>>>      return sis;
>>>
>>>
>>>
>>> _______________________________________________
>>> Groonga-commit mailing list
>>> Groonga-commit �� lists.sourceforge.jp
>>> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
>>>
>>
>> -- 
>> 結城 洋志 <YUKI Hiroshi>
>> E-mail: yuki �� clear-code.com
>>
>> 株式会社クリアコード
>> 〒113-0033 東京都文京区本郷3-27-12
>>              本郷デントビル2階
>> TEL : 03-6231-7270
>> FAX : 03-6231-7271
>> WWW : http://www.clear-code.com/
>>
>> _______________________________________________
>> Groonga-commit mailing list
>> Groonga-commit �� lists.sourceforge.jp
>> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
> 
> _______________________________________________
> Groonga-commit mailing list
> Groonga-commit �� lists.sourceforge.jp
> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
> 

-- 
結城 洋志 <YUKI Hiroshi>
E-mail: yuki �� clear-code.com

株式会社クリアコード
〒113-0033 東京都文京区本郷3-27-12
           本郷デントビル2階
TEL : 03-6231-7270
FAX : 03-6231-7271
WWW : http://www.clear-code.com/




More information about the Groonga-commit mailing list
Back to archive index