How to "set then read only" data?

agolangf · · 371 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I am writing a program that loads a ragged 2d array of integers from user input (either by file or stdin) and runs an intricate and extensive calculation on the array. The calculation is recursive in nature, and will carry non-constant state down the recursion tree. However once loaded, the array will not change.</p> <p>I am trying to develop as a programmer (in particular as a Golang programmer) and I was wondering canonical way to set and then access data later within a struct which discourages manipulation of the data after the fact, forbids it from modification by other files (or at least other packages). </p> <p>(By the way, is there a community wide way of describing something that is a canonical Go solution? Similar to &#34;Pythonic&#34;, but something that is a &#34;Go-to solution&#34; and completely &#34;Gosher&#34; )</p> <hr/>**评论:**<br/><br/>dlsniper: <pre><p>The community wide thing you are looking for is called &#34;idiomatic&#34; or &#34;idiomatic for/to Go&#34; or &#34;Go idiomatic&#34;. No need to invent a name for it.</p></pre>ChunkyCoder: <pre><p>Understood. Some time no gimmick is needed.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

371 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传