Go Kind Of Sucks

ThePrimeTime
17 May 202427:40

Summary

TLDRこのスクリプトは、Go言語に関する個人的な不満と改善点を掘り下げた議論です。デフォルトでnilのマップ、airラッピングの問題、インターオペラビリティの難しさ、特定のヒープタイプに対するガベージコレクションのパフォーマンスなどが指摘されています。また、goroutineの優先度の問題、チャネルの扱い、デフォルトのnilインターフェースの危険性などについても議論されています。しかし、言語の欠点だけでなく、どのようにそれらを回避し、より良いコードを書くかのアドバイスも提供されています。Go言語を始めとするプログラミング言語はそれぞれに欠点があると同時に、それらを克服するための方法も示唆しています。

Takeaways

  • 🧵 Go言語のデフォルトnilマップは便利な反面、エラーハンドリングが困難であると感じる人もいる。
  • 🔄 空振の回避とエラーハンドリングはGoでの開発で重要な要素であり、プログラマの責任で行われる必要がある。
  • 🔌 Go言語のインターオペラビリティが弱いと感じる開発者もいるが、実際にC言語と連携した経験がない人もいる。
  • 🚦 Goroutineの優先順位付けができないことが、スケジューラに依存してしまうと感じる人もいる。
  • 🚮 特定のヒープタイプに対するガベージコレクションのパフォーマンスが問題であり、Arenasが提案されていたが現在は却下されている。
  • 🔄 コンカレンシープリミティブの多くはチャネルを使用し、その改善が期待されている。
  • 🔒 Mutexを持つ構造体は、特定のメソッドで排他制御を行い、全体をMutexでラップする必要がない。
  • 📈 Go言語のメモリ確保の制御が難しすぎると感じる人もいるが、他の言語でも同様の問題が存在する。
  • 🚫 nilインターフェースのチェックが初心者に陥らせる問題であり、エラーハンドリングの難しさがある。
  • 🛑 Panicはエラーが発生した時にプログラムを停止させるためのものであり、不適切な使用は避けるべき。
  • 📝 Goのフォーマットツールの改善が期待されており、一部の開発者には問題があると感じられている。

Q & A

  • Go言語におけるデフォルトでnilのMapはどのような問題を引き起こす可能性がありますか?

    -デフォルトでnilのMapは、空のMapを扱う際のエラーハンドリングが困難になる可能性があります。また、nilのMapに対するアクセスが適切でない場合、ランタイムエラーを引き起こす可能性もあります。

  • ポインタの振る舞いに関するGo言語の欠点は何ですか?

    -ポインタを使用すると、非常に複雑なデータ構造を作成し、ガベージコレクションのパフォーマンスに影響を与える可能性があります。特に、ポインタが多数含まれる構造体は、ガベージコレクトが難しくなることがあります。

  • Go言語におけるgoroutineの優先順位に関する問題とは何ですか?

    -Go言語ではgoroutineには優先順位がなく、スケジューラによって実行が決定されます。これにより、特定のgoroutineが生成するガベージの量に基づいて、実行順序が変動する可能性があります。

  • Go言語におけるチャネルの欠点は何ですか?

    -チャネルは便利ですが、V2版が欲しくなるほどの改善点があります。チャネルはバッファリングされていない場合、デッドロックに陥る可能性があります。また、チャネルを閉じる際には、適切なエラーハンドリングが必要です。

  • Go言語におけるインターフェースのnilチェックはなぜ困難ですか?

    -インターフェースはnilである可能性があり、かつそのメソッドを呼び出すとpanicが発生するため、nilチェックが忘れられがちです。これは開発者がエラーを適切に処理できていない場合に問題を引き起こす可能性があります。

  • Go言語におけるメモリ割り当ての制約に関する問題とは何ですか?

    -Go言語では、開発者がメモリ割り当てを適切に管理できない場合、メモリリークが発生する可能性があります。特に、複雑なデータ構造を頻繁に作成する場合、ガベージコレクトが追い付かずメモリ使用量が増加する可能性があります。

  • Go言語におけるエラーハンドリングの欠点は何ですか?

    -Go言語のエラーハンドリングは明示的であり、エラーが発生する可能性のあるすべての場所でエラーをチェックする必要があります。これはコードの冗長性を招く一方で、エラーの発生時にプログラムを適切に停止させることができる利点があります。

  • Go言語における並行性プリミティブの問題とは何ですか?

    -Go言語ではgoroutineとチャネルを用いて並行性を管理できますが、それらを適切に管理することは困難であり、デッドロックや競合状態を引き起こす可能性があります。

  • Go言語におけるテストの安定性に関する問題とは何ですか?

    -並行性を含むGo言語のコードは、テストの安定性に関する問題を引き起こす可能性があります。テストが実行される順序やタイミングによって、テスト結果が変動する場合があります。

  • Go言語におけるパフォーマンスの欠点とは何ですか?

    -Go言語はガーベージコレクションを行うため、特定の種類のヒープに対してパフォーマンスが低下する可能性があります。また、チャネルやgoroutineを使用する際にもパフォーマンスへの影響があります。

  • Go言語におけるデフォルトのnil値に関する問題とは何ですか?

    -Go言語では変数を宣言した際に初期値としてnilが設定されるため、nilの値を適切にチェックしなければならない点が問題となります。これは開発者がnilポインタ例外などのエラーを引き起こす原因になる可能性があります。

  • Go言語におけるインターオペラビリティの問題とは何ですか?

    -Go言語は他の言語との相互運用性において制限があり、C言語などの他のコードとの連携が困難になる場合があります。これは外部関数インターフェース(FFI)を扱う際に問題が発生する可能性があります。

  • Go言語におけるデバッグの難しさとはどのようなものですか?

    -Go言語ではデバッグが困難であると感じることがあります。特に、並行性やチャネルに関するバグを追跡することは、デバッグの複雑さを高める要因となります。

  • Go言語におけるパフォーマンスモニタリングの問題とは何ですか?

    -Go言語ではパフォーマンスモニタリングが難しい場合があります。パフォーマンスのボトルネックを見つけるためには、適切なツールやメトリックスを使用する必要がありますが、それらが常に利用可能であるとは限りません。

  • Go言語におけるエラーの返却に関する問題とは何ですか?

    -Go言語では複数の値を返却するため、エラーを適切に処理する必要があります。しかし、エラーが返却される順序や方法によっては、エラーの特定やハンドリングが困難になることがあります。

  • Go言語におけるデフォルトのnil値が引き起こす問題とは何ですか?

    -Go言語では、変数が初期化されていない場合にデフォルトでnilが割り当てられるため、nil参照エラーが発生する可能性があります。これは開発者がnilを適切にチェックしなかった場合に問題を引き起こす原因となります。

Outlines

00:00

📝 Go言語の欠点と改善点についての個人的な意見

スクリプトではGo言語に関する個人的な不満と改善された点を探求します。特に標準的な批判ではなく、実際の問題点について議論します。マップの初期値がnilであることや、エラー処理の冗長性、他の言語との連携性、ゴルーチンの優先度の問題、ガーベージコレクションのパフォーマンスなどが挙げられます。また、改善された点として、特定のヒープタイプの問題がアリーナによって解決される可能性があることが触れられています。

05:00

🔄 Go言語における並列性とエラーハンドリングの議論

第2段落ではGo言語における並列性の問題とエラーハンドリングのアプローチが議論されています。チャンネルの使い方、データ競合、ゴルーチンの終了管理、テストの不安定性などについて言及され、Go言語における並列性に関する様々な課題が指摘されています。また、エラーハンドリングにおいては明示的なエラー処理が行われることが強調されています。

10:01

🛠 Go言語におけるメモリ管理とエラー処理の難しさ

第3段落ではGo言語におけるメモリ管理の問題とエラー処理の難しさが述べられています。インターフェースのnilチェックの重要性、パニックの使用、構造体のフィールドの返り値の使い方などについて触れられ、Go言語での開発における注意点が詳細に説明されています。

15:03

🔍 Go言語における構造体のミューテックスとエラーハンドリング

第4段落ではGo言語における構造体とミューテックスの使い方、エラーハンドリングのアプローチが議論されています。ミューテックスを構造体に持たせることの利点、エラーが発生した時のプログラムの停止、Rustにおけるエラーハンドリングとの違いなどが説明されています。

20:04

📚 Go言語におけるコード管理とリソース管理の問題点

第5段落ではGo言語におけるコード管理とリソース管理の問題点が挙げられます。構造体のフィールドの返り値の使い方、ゼロ値の有用性、エクスポートされた構造体フィールドのメソッドの問題、コンテキストの使い方などが議論され、Go言語での開発における注意喚起事項が詳細に説明されています。

25:06

🤔 Go言語の欠点と学習曲線についての個人的な感想

最後の段落では、Go言語の欠点と学習曲線についての個人的な感想が述べられています。言語ごとの特性や欠点を理解し、それらを経験することで問題を回避することができると強調されています。また、どの言語にも独自の問題点があることを認め、Go言語をおすすめする意気込みが示されています。

Mindmap

Keywords

💡Golang

Golangは、Googleによって開発されたプログラミング言語です。その特徴はシンプルさとパフォーマンスであり、特にネットワークやコンカレンシーに適しています。ビデオではGolangの欠点について議論しており、言語の選択肢として推奨されていることからも、ビデオの主題と密接に関連しています。

💡エラー処理

エラー処理は、プログラムが異常を検知し、それを適切に処理する方法を指します。Golangでは、エラーを明示的に返す方法が一般的ですが、ビデオではエラー処理が煩わしいと指摘されています。これは、言語の欠陥として捉えられており、ビデオのテーマに沿った重要なポイントです。

💡nil

nilは、Golangにおける値の欠如を表す特殊な値です。ビデオでは、nilをデフォルト値として使用する際の問題について触れられています。これは、言語の設計に関する議論と関連しており、ビデオの核心的なトピックの一つです。

💡インターオペラビリティ

インターオペラビリティとは、異なるシステムや言語が協調して働く能力を指します。ビデオではGolangが他の言語との連携が困難であると述べられており、これは言語選択時の重要な検討ポイントとなります。

💡ゴミ収集

ゴミ収集は、プログラムが使用していないメモリを自動的に解放するプロセスです。ビデオではGolangのゴミ収集のパフォーマンスに関する議論があり、特定のヒープタイプでは問題が生じる可能性があると指摘されています。これは、言語のパフォーマンスに関する重要な側面です。

💡goroutine

goroutineは、Golangにおける軽量のスレッドです。ビデオではgoroutineの優先順位付けの欠如や、それによって生じる可能性のある問題について触れられています。これは、並行性とパフォーマンスの議論において核心的なトピックです。

💡チャネル

チャネルは、Golangで並行性を実現するための主要な機能です。ビデオではチャネルの利便性と欠点を評価しており、言語の並行性モデルに関する重要な議論ポイントです。

💡コンカレンシー

コンカレンシーは、複数のタスクが同時に実行されることを意味します。ビデオではGolangにおけるコンカレンシーの実装とそれに伴う問題について議論されており、言語の設計とパフォーマンスに関する重要な側面です。

💡パフォーマンス

パフォーマンスは、ソフトウェアがタスクを実行する速さと効率を指します。ビデオではGolangのパフォーマンスに関する様々な議論があり、言語の選定と使用において重要な検討事項です。

💡メモリ管理

メモリ管理は、プログラムがメモリを効果的に使用し、不要になったメモリを解放するプロセスです。ビデオではGolangにおけるメモリ管理の課題について触れられており、言語のパフォーマンスとリソース使用に関する重要なトピックです。

Highlights

Maps being default nil can lead to issues with error wrapping and stack races.

Poor interoperability with other code, such as difficulties in interacting with C.

Goroutines can't be prioritized, leading to potential performance impacts.

Garbage collection performance may be improved with Arenas for specific heap types.

Complex data structures with pointers can hinder garbage collection efficiency.

Difficulty in converting IO buffers or readers into channels.

Verbosity in Go is considered a downside by some, especially with error handling.

Try-catch error handling is criticized for being verbose and hard to manage.

Go's explicit error handling is seen as verbose but also as a feature that ensures explicitness.

Concurrency primitives like channels have their drawbacks, such as difficulty in closing channels properly.

Go routines don't require lifetime management, which can be a double-edged sword for new developers.

Writing games in Go can be challenging due to garbage collection and other language affordances.

Panic is seen as a useful feature in Go for handling fundamental program errors.

Mutex in a struct can be a design choice to protect specific data or operations.

Defer is criticized for causing issues in large codebases and for its use in cleanup.

Go's tooling like go format and go vet could be improved for better code management.

Every programming language has its own set of challenges and pain points.

Transcripts

play00:00

what sucks about goang I saw a post this

play00:03

post in r/ Russ and wanted to ask about

play00:04

goang too not the basic criticisms the

play00:07

veros verbosity Telemetry uh but what

play00:10

are your personal uh bug Bears uh the

play00:13

things that let's see the things that

play00:14

are getting better Etc I think I have a

play00:17

couple I have a very simple one I hate

play00:19

Maps being default nil air wrapping is

play00:22

really really nice but it also can be a

play00:24

pain I'd like to make sure to always

play00:26

have really good stack races sometimes

play00:27

just like you know when you get an air

play00:29

and you don't have it w properly

play00:30

sometimes it's kind of it's going be a

play00:32

you know you do have to rely on the

play00:34

programmer to really be very very very

play00:37

consistent in its air wrapping and so I

play00:39

find that to be really one of go Link's

play00:41

R you know what I mean air equals nil

play00:45

doesn't actually bother me honestly air

play00:46

equals nil never has bothered me all

play00:49

right I'm continually editing the list

play00:51

poor interoperability with other code I

play00:53

don't know what that means like you

play00:54

can't interact with C easily if that's

play00:57

the case then I guess I've never had ffi

play01:00

as something I've had to do so I don't

play01:02

really have like I have I it's just a

play01:05

black box to me I've literally never

play01:07

done it myself I've used it obviously

play01:09

like you know when I use Lua and I'm

play01:11

calling into Vim I'm calling into to see

play01:13

functions like I get that I get the

play01:15

concept I've just never done it and so I

play01:17

don't really understand what it means by

play01:18

poor uh uh poor interoperability I don't

play01:21

know I've just never had I've never just

play01:23

had that experience right uh I don't

play01:25

know what SEO is means let's see me

play01:28

let's see means something important PPR

play01:29

function it is lost like I understand

play01:31

all those words individually including

play01:33

CPR I don't know SEO uh but I but I

play01:35

don't get that okay unable to prioritize

play01:37

certain go routines go routines that

play01:39

generate no garbage can be uh be

play01:40

impacted as much as those creating more

play01:43

garbage okay okay I I could see that

play01:46

being it's an interesting take at least

play01:48

can we agree that that's an interesting

play01:50

take you have no prioritization of go

play01:52

routine so therefore you're kind of just

play01:53

you're sub subjugated to the the whims

play01:56

of the scheduler and that's that I'd say

play01:58

that's fair that's fair

play02:00

uh let's see poor garbage collection

play02:01

performance with specific types of heaps

play02:03

may be addressed by Arenas now well

play02:05

Arenas have been you know have been

play02:07

largely said no to I really hope they

play02:09

come back with a new proposal I'm

play02:10

curious what this means does anyone know

play02:12

what this means does anyone like Judo do

play02:14

you know what that means what is what

play02:16

does it mean to have poor poor

play02:18

collection for certain types of of

play02:20

objects on the Heap like is there

play02:22

something that I I don't understand is

play02:24

it just when you have like strs with

play02:25

pointers with strs with pointers isn't

play02:28

green thread prioritization and anti in

play02:30

concurrency my assumption is that it's

play02:32

almost impossible to get right that's my

play02:35

assumption yeah he he means certain

play02:37

allocation patterns okay so I assume

play02:39

what what he means by this one is uh is

play02:41

going to be a struct with pointers that

play02:43

those pointers are structs with pointers

play02:46

and so then you just get this like if

play02:48

you want to see if you can collect this

play02:49

thing you have this like whole graph

play02:51

walking experience that you have to go

play02:53

on to is is my assumption of what that

play02:56

means is that is that fair I mean I

play02:57

could I could see that being uh I could

play02:59

see that being a negative but at the

play03:00

same time it's like I don't know you

play03:02

also create I mean what do you want you

play03:04

create an extremely complex data type

play03:06

with lots of pointers and a lot of you

play03:08

know following and then it doesn't

play03:09

perform well with a generic garbage uh

play03:12

collector yeah and I think adras Arenas

play03:14

would clearly address this but still

play03:16

it's like you kind of get what you get

play03:17

you know if you have really complex data

play03:19

structures and you make them really

play03:20

really frequently you can also pull them

play03:22

so they just don't get collected and

play03:23

then you just don't have that problem

play03:25

right like that could be nice uh many

play03:27

gotu with concurrency Primitives closing

play03:28

channels yes I do agree that the

play03:30

channels though wonderful just I feel

play03:32

like a channels V2 would be fantastic

play03:34

gof Funk closure data races the

play03:36

attraction for newbies to buffer

play03:37

channels arbitrarily unnecessary use of

play03:39

concurrency mechanism because they're

play03:41

the first class citizens go routines

play03:42

don't require lifetime management I'm

play03:44

not sure what this this means like you

play03:46

don't need a context to be passed into a

play03:48

go routine so it doesn't get killed is

play03:50

that what that means I think that's what

play03:52

they're trying to say is that you don't

play03:53

need reading this list it sounds like

play03:55

something coming from a Game Dev

play03:56

perspective Ah that's very interesting

play03:58

yeah I would say that if you're choosing

play03:59

go playing as as the language to write

play04:01

games in like you're you're you're

play04:03

you're fundamentally in an uphill battle

play04:05

I think that's fair to say because

play04:08

anytime you're in a garbage collected

play04:09

language you get certain affordances

play04:12

which make writing programs easier but

play04:14

that certain affordances Mak certain

play04:16

types of programs by definition hard

play04:19

right so garbage collection is a

play04:21

fundamentally hard activity to have when

play04:24

you're writing games you can write

play04:26

pretty solid games but you're not

play04:27

writing Starcraft or factorio and go

play04:28

yeah yeah yeah I think there's things

play04:30

that I think there's things to love and

play04:32

go but there's also like the four things

play04:33

that make go or the three things that

play04:35

make uh uh channels difficult I do agree

play04:37

like one thing I really dislike is that

play04:39

it's very hard to take an IO buffer or

play04:41

an IO reader and turn it into a uh

play04:44

Channel I don't know the way to do it

play04:47

other than like you have to it's very

play04:49

hard to do the conversion between the

play04:51

two you have to you have to create your

play04:53

own little reader and that then pumps

play04:55

out into a channel and it's just like

play04:58

you know I just don't love it

play05:00

I just don't love it why would you do it

play05:01

because sometimes you just want to you

play05:02

want to channel you don't you don't want

play05:04

to have to do the reader writer I feel

play05:05

like go is stupidly verbose I haven't

play05:08

really hit the verbose level yet right I

play05:10

I haven't I'm writing a very complex

play05:13

program in go and I do not have any

play05:17

problem with the current verbosity it's

play05:19

verbosity and air handling I don't think

play05:21

it's verbose and air handling I think

play05:23

that's just the difference between I

play05:24

think most people that state that are

play05:26

used to tr catch styled air handling

play05:30

I think if you're used to tr catch

play05:32

styled air handling airs as values feel

play05:34

verbose but airs as values are are

play05:38

inherently nicer right they're

play05:40

inherently nicer uh TR catch is evil I

play05:43

generally think TR catch is evil I I

play05:45

generally think that uh shiting control

play05:47

flow is really hard I think that it's

play05:50

it's very hard to get TR catch to be

play05:52

right you know also people uh also

play05:54

people that consider uh that typesafe

play05:56

code never handles errors properly yes I

play05:58

mean I mean it's the it's like my big

play06:00

gripe about typescript I've said it a

play06:01

bajillion times so I don't need to like

play06:02

beat a dead horse but typescript isn't

play06:05

type safe because it it just isn't type

play06:07

safe but B it also just has really poor

play06:09

error handling because JavaScript is

play06:11

poor error handling right it's just it

play06:13

is poor it's not it's not as good as

play06:15

erors as value erors as values will

play06:17

always be the best like every single

play06:19

time it's oh it's always awkward it's

play06:21

super awkward in uh it's okay to fail

play06:24

situations and so what I mean by that is

play06:25

you have a call and if it fails that's

play06:27

okay you can just go to the next thing

play06:29

so then you have this like TR catch

play06:31

where you have to define the variable

play06:32

outside the tri catch scope block and

play06:34

then set it through through it and then

play06:35

on the outside then you have to check it

play06:37

like it becomes these really long

play06:39

verbose like activity what should I try

play06:42

instead of try catch so when you so I

play06:44

can tell by the way you're asking this

play06:45

you could have you could have dropped

play06:48

this as a a newbie programmer and just

play06:50

asked this and I would have actually

play06:51

known try so you have to try a different

play06:54

language you can't really I mean you can

play06:56

technically get the experience in

play06:59

typescript by using effect um or other

play07:02

error result handling objects but the

play07:05

problem is is that you have to call

play07:06

every function with it because you don't

play07:07

know when a function like if you use a

play07:09

library you don't actually know if that

play07:10

Library will throw you just simply

play07:12

cannot tell you cannot tell in

play07:16

JavaScript if something will explode you

play07:18

just don't know and so you kind of have

play07:20

to wrap everything in a TR catch because

play07:23

you just don't know whereas when you're

play07:24

using something like go if it airs it

play07:27

airs every time in a certain way and so

play07:30

you like no you're like okay if I call

play07:32

this function 100% of the time I know

play07:35

this function could ER therefore I need

play07:37

to handle it and do something about it

play07:40

which is that's why people say that go

play07:42

air handling is verbose it's verbose

play07:44

because it's explicit it's not verbose

play07:47

because it's verbose now rust has kind

play07:50

of better err it's kind of I only say

play07:52

kind of because remember you have to

play07:55

lift out values and so you still have

play07:58

these big decision points that happen

play08:00

Zig might be the most convenient of them

play08:03

all I think go is really really good not

play08:05

much different than fpus yeah yeah

play08:07

either Mo ads result objects either the

play08:09

same the same same thing right anyways

play08:11

all right let's keep on going uh many

play08:12

gotas with concurrency I do agree with

play08:14

this there is definitely some of that uh

play08:15

this I don't really get but I assume it

play08:17

means you you don't have context

play08:18

required so that go routines get

play08:19

terminated when your context is done but

play08:21

that's kind of more of a skill issue but

play08:23

I do agree it'd be nice to just have

play08:24

autom magic handling right I think we

play08:26

could all agree that it'd be nice to

play08:28

have automagic handling of retains flaky

play08:30

test because of assumptions that don't

play08:32

hold up with current current code I mean

play08:34

again that's your own that's that that's

play08:36

just skill issue that's pure skill issue

play08:38

if you write code in such a way that you

play08:40

have flaky test because of concurrent

play08:42

code that's your fault like real real

play08:46

talk here's a good example of it I'm

play08:48

going to jump over here I'm going to

play08:49

open this up and I'm going to go Doom

play08:50

test uh right here so I wrote the Doom I

play08:53

wrote launching Doom from go and I did

play08:57

this right here

play08:59

you see what this does right here this

play09:01

forces synchronization so all doom

play09:05

programs once they read their header

play09:07

will let you know when they are

play09:09

ready okay I am now ready and I'm

play09:12

running but I will let you know when I'm

play09:14

ready so I have a forced synchronization

play09:16

point so I so I know that rows and

play09:18

columns are now defined I know

play09:19

everything about the program and so it's

play09:21

like yeah I can I can kind of go through

play09:24

and do uh I I can I can think through

play09:28

the concurrency problem so when I see

play09:29

this thing that uh flaky test that's

play09:32

appear your bad right it's your

play09:37

bad synchronization blocking during IO

play09:40

channels not as performant as people may

play09:42

expect well I mean it's a mutex dog

play09:44

right there's a mutex in a in a channel

play09:46

so yeah I mean I

play09:50

mean I mean you can't use channels for

play09:52

everything right spawning a bunch of go

play09:54

routines is lightweight cheap according

play09:56

to everything you read but really go

play09:58

does have a of again of course but the

play10:01

cost is pretty lightweight it's no

play10:02

different than like say Tokyo right or I

play10:04

assume it's much not different than

play10:07

Tokyo it it probably it's within the

play10:08

same operating Paradigm as Tokyo which

play10:11

is just anytime you have uh green

play10:13

threads they come with a necessary cost

play10:15

because there's always a runtime

play10:16

associated with it uh and if you don't

play10:19

understand that I I feel like

play10:21

that's I mean for me that's more like

play10:23

skill issue like they're

play10:25

cheap they are lightweight Che like

play10:28

that's proper to say cuz what's the

play10:29

alternative to does anyone know in chat

play10:32

I know there's a lot of newer people

play10:34

does everybody know what the alternative

play10:37

is to a green thread OS thread yeah yeah

play10:40

exactly and those things are effing

play10:42

heavy like those things aren't

play10:44

lightweight like you're not you're not

play10:45

getting you're not getting a lightweight

play10:48

experience doing those a yellow one

play10:51

right so so it's like when they say

play10:53

lightweight you got to remember that

play10:55

lightweight is is a relative term you

play10:58

know your mom your mom's a thread CH

play11:01

dude chat is a chat chat a little silent

play11:03

today chat's a little weird today chat's

play11:05

always a little weird today you know it

play11:07

just is okay Iota use a numer you say uh

play11:10

when your whole data structure fails to

play11:12

unmarshal uh on unknown values I mean

play11:15

that's true in any that's true in any

play11:17

strict uh type language right so rust

play11:19

does the exact same thing if you have if

play11:22

you have missing values and things if

play11:24

you if your definition does not match

play11:25

what comes in it just blows up and it's

play11:27

just like can't do it I guess I don't

play11:30

know what they mean by this maybe they

play11:32

mean that if there's an extra value then

play11:33

it can't decode if that's the case then

play11:36

yeah that' suck I just thought it would

play11:37

drop it I'd have to check that out uh

play11:39

Iota I agree Iota and enumerations are

play11:42

largely

play11:43

dumb no ability to have a static map you

play11:45

can create a function that returns a

play11:47

constant map but then you lose control o

play11:49

uh over it going on the Heap often

play11:51

resulting in package level map that can

play11:53

be modified fighting resisting m

play11:55

mutability in general fair fair fair

play11:58

fair take Fair take many apis and

play12:00

packages don't give the caller control

play12:01

of memory allocations I mean it's a it's

play12:05

not a

play12:06

managed it's not managed memory you know

play12:09

difficult to constrain memory

play12:10

allocations sure you can Benchmark and

play12:12

eliminate hotspots or add Telemetry slm

play12:14

monitoring you can also pull I've never

play12:15

found a good way to keep the lid on it

play12:17

at compile time you can pull right uh

play12:20

pooling is probably one of your best

play12:21

options here some unit tests can be

play12:23

written to check allocations but those

play12:24

rely on existing uh code

play12:26

paths I mean I'd say that

play12:30

here's what I got to say I'd say that if

play12:31

you have a hard time creating new memory

play12:35

you're probably going to have a hard

play12:36

time creating new memory in any language

play12:38

I I'm not sure is there is there like I

play12:42

don't really get that critique in the

play12:43

sense that if you can't constrain how

play12:45

much memory you're creating in go I

play12:48

don't think rust or any other language

play12:50

solves that right does any does does

play12:53

anything actually

play12:55

solve does any language solve this I I I

play12:58

don't think so

play13:00

because you still if you have to create

play13:01

the objects you're creating them no

play13:02

matter what C does not solve it you

play13:04

still have to free it right it's kind of

play13:07

strange thing to see Zig allocators but

play13:08

you're not actually I mean the thing

play13:10

about Zig allocators is you get Arenas

play13:12

so cleanup is really easy right you

play13:14

could have your own little Arena

play13:15

cleanups and all that so yeah yeah yeah

play13:16

I I I get that

play13:18

but it well it can stop it can't stop

play13:20

you from being an idiot exactly like

play13:22

that's what I'm seeing is

play13:23

that you constrain memory allocations by

play13:27

manually constraining memory allocations

play13:29

and whether you're in rust or Zig or or

play13:32

C or go if you create a million objects

play13:35

you create a million objects there's not

play13:37

there's not really there's not really

play13:38

two ways around it a nits a foot gun

play13:40

agreed I I don't use it I've never seen

play13:42

anything good from use it yep just never

play13:43

use it uh nil interface checks are a

play13:46

gotta to almost every single newbie at

play13:48

some point I got got by this one so I

play13:50

think that this is the the the fact that

play13:52

you can call a function on a nil I think

play13:56

is a fundamentally bad decision the

play13:58

error from is absolutely bizarre and it

play14:00

takes you a long time to realize what's

play14:02

happened I think that that is by far

play14:05

Go's single greatest mistake yeah I'm

play14:09

confident in that I'm absolutely

play14:10

confident in that right uh panic I think

play14:13

Panic is fine I I like panic I in fact

play14:16

dude dude dude dude last night I decided

play14:21

to do this I got a little frisky okay in

play14:23

my antsy parser I decided to give it the

play14:25

ability to decide how wide you want your

play14:28

bite do you want your bite to be 8 bit

play14:31

8bit resolution or 16bit resolution for

play14:34

how big it is or even larger 32bit

play14:36

resolution so I made this idea of these

play14:38

bite iterators and bite writers to be

play14:40

able to go through and write at differ

play14:42

sized widths right which was going to

play14:43

cause like a gigant I I got to quit

play14:45

saying the word right it's going to

play14:46

cause like all these giant headaches but

play14:49

I was smart

play14:51

enough s and madams to do this is that I

play14:55

heavily assert my code and I heavily add

play14:59

in a bunch of state to my asserts so I

play15:02

have this notion in my asserts that uh I

play15:05

can add assert data that prints it out

play15:07

at the end and so what I did here is

play15:10

that I created a single state object and

play15:12

then I passed that single state object

play15:14

into my assert so when I fail it

play15:18

naturally will cause um a nice assert

play15:21

pattern so check this out so let's go

play15:22

back to my little writer uh let's go

play15:24

back to my RGB writer and I have this

play15:26

whole uh there we go this is what I'm

play15:28

looking for right there I'm going to

play15:29

take this out for just a second and just

play15:32

go like this all right cuz that's what I

play15:34

had at one point and I'm going to go

play15:35

here and I'm going to go go run uh go

play15:38

test there we go I think this should

play15:40

work out bam look at that we got

play15:42

ourselves a nice little beautiful we we

play15:44

failed on something but I don't think

play15:45

that that's what I want to do is it an

play15:47

parser or is it go run hold on what's

play15:49

what am I trying to do oh yeah I've made

play15:52

changes dang it I made changes um can I

play15:55

go like this add add uh ccz give me that

play15:59

little czz uh go like this and let's go

play16:02

like that plus one there we

play16:05

go wait hold on sorry hold on I just oh

play16:11

my goodness why are you lying to

play16:15

me dang it what did I do working example

play16:17

of this

play16:22

thing hold on hold on

play16:35

oh my

play16:36

goodness I forgot that I had uh I forgot

play16:39

that I had uh

play16:43

had forget about it forget about it

play16:46

forget about it you know what forget

play16:48

about it forget about it I don't even

play16:49

want to show you anyways I it was so

play16:53

good I wish I could show you but it was

play16:55

so good but effectively the

play16:59

get checkout Master uh get stash pop

play17:03

okay anyways the general idea was that I

play17:06

was able to take I was I was able to see

play17:09

exactly where my parser failed because I

play17:11

panicked the program and the idea is

play17:13

that no matter what I do you'll see

play17:15

aerts everywhere like if I try to

play17:17

produce a frame and my current row isn't

play17:19

the length and my current index isn't

play17:20

the length of the data uh holding it in

play17:23

like if I'm not perfectly at the end my

play17:25

exact data that I expect I should the

play17:27

whole program should just stop working

play17:29

and I'll print out the current state of

play17:30

everything and so it's i i find I

play17:33

absolutely love like I love that I love

play17:35

panic panic is fantastic Panic is one of

play17:37

the greatest things ever ex that ever

play17:39

exist bad use of panics not good Panic

play17:43

is hot yeah there's also the range bug

play17:44

but they fix that one two two yeah a

play17:46

Define bad use if you just panick

play17:49

because something didn't go the way you

play17:50

wanted it to that's not good you panic

play17:53

when the when the program fundamentally

play17:56

um you panic you panic in code when when

play17:59

the fundamental assertion about the

play18:00

universe is wrong your Universe of

play18:02

course right it's like expect well you

play18:04

don't have unwrap you have expect though

play18:06

in

play18:07

Rust right right and so like when you're

play18:09

here and you go like this when you go

play18:10

like if you're in Rust and I had like

play18:12

food. expect you know blah blah you know

play18:15

uh let you know let V equals this right

play18:18

like I'm saying something about the

play18:19

universe this could never break right so

play18:22

if Fu was a mutex and I did this in

play18:25

Rust like this should always work if it

play18:28

doesn't work

play18:29

then you have like fundamentally broken

play18:31

the universe and your program no longer

play18:32

works anymore and you should just crash

play18:33

the whole thing like get the hell out of

play18:35

here it's broken forever

play18:37

right I panicked in my interview today

play18:40

oh don't panic in your interview Jeremy

play18:42

let's see mutex in a struct no idea what

play18:45

it's meant to

play18:46

protect yeah I actually like this I

play18:49

actually like this the reason why I like

play18:51

mutex and instruct so this is so you can

play18:53

tell this person does a lot of rust uh

play18:56

uh the reason so the thing about rust is

play18:58

that rust if you have a value that is

play19:00

shared across uh threads right whatever

play19:02

this value is you always have to wrap it

play19:04

in an arc mutex whatever this value is

play19:06

so you have to wrap like an entire

play19:08

struct in an arc Comm mutex or if or if

play19:12

you want like you always have to wrap

play19:13

the top level whereas with go let's say

play19:17

that you had a struct that almost all of

play19:19

its operations required no mutex anyone

play19:21

from anywhere could call it except one

play19:24

place then you have a mutex that hangs

play19:26

off of a struct definition right

play19:29

and you know mutex uh sync uh sync uh

play19:33

what is it mutex there we go and then I

play19:35

have this one mutex that exists right

play19:37

here right I'm doing an inline one right

play19:40

there we go this thing right here I now

play19:43

have this one mutex that when I call

play19:45

this one particular function I then can

play19:49

lock and unlock which I think is a much

play19:51

better way to do things it's yes it's

play19:53

more air prone for sure but it allows

play19:57

you to choose when lock happens mutex in

play20:00

instruct makes sense yeah I think it I

play20:02

think it's the better way uh is there a

play20:04

case where a mutex lock being error

play20:06

wouldn't be we would crash the whole

play20:07

program I do not know when that would

play20:09

happen to me if my mutex I got a

play20:11

poisoned lock like that whole thing is

play20:13

just done various readers and uh a

play20:15

single writer is a good example of this

play20:17

exactly like you don't need you don't

play20:19

need this super complex like I don't

play20:21

need my whole struct wrapped into mutex

play20:23

to access because then if you just want

play20:25

to access a read value and you have

play20:27

rights coming in you have you can do

play20:28

readwrite Locks but still you have to

play20:30

like interweave them or you could just

play20:32

have a bunch of methods that that do a

play20:35

bunch of reading and then one uh than

play20:37

one that does that uh mutex uh in a

play20:39

struct feels like a design smell it

play20:40

doesn't feel like a design smell to me

play20:42

at all it feels like you're designing a

play20:44

program you're designing a program that

play20:45

makes perfect sense right and to me

play20:47

that's just I I like that I like it I

play20:49

like it I like it uh go routine

play20:51

lifetimes are important to manage but go

play20:53

gives you uh context context and says

play20:55

good luck yeah I mean you already made

play20:56

that you made that point earlier up here

play20:58

I think um I'm not sure I I don't know

play21:00

how I feel about context yet I'm still a

play21:02

newbie when it comes to passing around

play21:03

context and really taking that into

play21:05

consideration my program I'm still a

play21:07

noob so I don't have a I don't have like

play21:08

a good feel for that yet seemingless

play21:11

endless PR comments this function method

play21:13

constant struct field return value is

play21:15

unused uh this is great I love that uh I

play21:18

also hate it but I love it did you mean

play21:20

to initialize this struct something uh

play21:22

something zero values are

play21:24

useful uh are zero values ever useful I

play21:27

don't know maybe uh don't export this

play21:29

mutch struct field method yeah I mean

play21:31

but you just didn't export it come on uh

play21:33

something to do with uh constraining

play21:35

mutability okay that's fair I get it

play21:37

that go lets you have more mutability so

play21:39

it is harder so I I do I do understand

play21:41

that import ordering I've never had that

play21:43

as a problem uh things from effective go

play21:45

that could be built into tooling okay I

play21:47

mean that's just a a tooling issue maybe

play21:50

but that's if effective go is considered

play21:51

the the deao standard uh other notables

play21:54

defer almost makes me let's see makes

play21:56

the suck list for me in a large codebase

play21:58

it's frequently cause contributing a

play21:59

contributor to

play22:03

issues I feel like I I want to say I

play22:06

agree with this one I do want to say I

play22:09

agree with this one I do want to say I

play22:11

agree with this one just because it is a

play22:14

pain in the

play22:16

ass to deal with defer why is my cursor

play22:20

flickering it flickers only over HDMI I

play22:22

don't I don't know

play22:25

um because I've been bit by the defer

play22:27

many many times s like it's it's weird

play22:30

to me to have a

play22:32

server that you have to

play22:34

close when it's when the program ends

play22:38

like that's one thing I like about rust

play22:39

is the Drop Like drop closes the server

play22:42

you know what I mean like Drop closes

play22:44

the server so it's like why why do I

play22:47

have to deal with with that drop is a

play22:49

trait in Rust I know and so I love I I

play22:51

like that defer makes a foray yeah yeah

play22:54

it's not about having to close it it's

play22:56

about clean up since there are no

play22:57

destructors yeah exactly I don't know

play22:59

how I feel about that like destructors

play23:02

are interesting shall we say I I know

play23:07

they're a pain in the ass and there's so

play23:09

many like the the inverse ordering of

play23:11

destructors and all that stuff could be

play23:12

a huge like a huge source of bugs but

play23:14

they're also really nice but defur is

play23:17

used for so much more than closing

play23:18

connections I know it's used for closing

play23:19

files it's used for a lot of things ass

play23:21

mentioned so much ass being mentioned um

play23:24

I don't know I'm not sure how I feel

play23:26

about it yet I'm sure there's some good

play23:27

cases that I'm missing but defer I can

play23:30

find that to be it's both really really

play23:32

fantastic and it's a really big pain in

play23:33

the ass go format and go vet could be

play23:35

much better yeah I mean that's a

play23:37

personal opinion thing I do agree like

play23:39

me personally the fact that like

play23:40

something that I will never like about

play23:42

this there's nothing you can convince me

play23:44

to like this

play23:46

uh like uh sorry wrong casing to screw

play23:49

off all right

play23:53

uh like this

play23:57

um oh I can't even format right

play24:01

now like that there you go that's the

play24:03

one I'm looking for like that I hate

play24:05

that I hate that I hate that I hate

play24:13

that I swear there's sometimes where it

play24:15

it puts the plus sign right next to it

play24:17

as well but I hate that I hate I hate

play24:20

that it takes away the spacing like it's

play24:23

not that I dislike it it's that I hate

play24:26

it which is much different

play24:29

there's a huge differ a huge difference

play24:32

between me just like it's actually

play24:35

anyways that's like one thing I hate so

play24:37

yes I I I I do agree with that one

play24:39

statement I hope you never need to check

play24:41

the return value of timer uh time timer

play24:44

stop I didn't even know there was a

play24:46

return value uh future you will

play24:48

appreciate if you start passing context

play24:49

in time as an argument starting today

play24:51

okay I don't understand the time part

play24:53

but okay a context I know I need to

play24:55

start using it more but I don't uh but

play24:57

that's more like just creation uh your

play24:59

time will come where you don't capture a

play25:01

loop variable that's gone that's a gone

play25:03

one you know what I mean this is no

play25:05

longer a problem one 122 solves that one

play25:07

122 actually properly uses it some of

play25:09

these might uh let's see some of these

play25:10

things might not be things that suck

play25:12

about ghost specifically I wrote what

play25:14

first came to mind okay I mean I like

play25:15

this list I like some of the lists some

play25:17

of them I don't like overall pretty good

play25:20

critiques the thing is is that every

play25:23

language sucks they just suck it just

play25:27

sucks all the time and anyone that

play25:29

thinks that that there's actually some

play25:31

sort of Silver Bullet to make

play25:32

programming nice dude someone's selling

play25:34

you something you know what I mean

play25:36

someone has

play25:38

officially someone has officially sold

play25:40

you something wait we got coffee again

play25:45

me this account is such a troll account

play25:48

this is such a troll

play25:50

account they're mean to me um anyways

play25:54

you just got to choose what you you just

play25:55

got to choose what you saw dude look at

play25:57

this you guys want to see something

play25:58

that's totally messed up they're now

play26:00

following me again that was nice of them

play26:02

uh they quit following me for an

play26:03

afternoon just to mess with me uh look

play26:06

at that it just unfollowed me who does

play26:09

that who does that who does that Adam is

play26:13

so toxic I think that's the thing is

play26:15

Adam is so nice on the internet because

play26:17

he can be so toxic I did that yeah Adam

play26:20

gets to be so toxic via terminal do shop

play26:23

that he that he gets to be nice on the

play26:26

internet and then just alt accounts

play26:28

that was me look there's even Adam right

play26:30

here I want the credit turd just a turd

play26:33

okay yeah good list good list overall uh

play26:36

follow terminal shop they'll probably

play26:38

not follow you back uh the

play26:40

name the name is the prime engine I do

play26:43

like ghost I still highly recommend go

play26:45

by the way I I've enjoyed it I've had no

play26:48

problems with it I think it's just a

play26:49

fine language I think any I think I I I

play26:51

honestly think the biggest critiques

play26:53

about go They're not they're they're

play26:55

definitely not great it's definitely a

play26:57

language that you learn with exper

play26:58

experience and as you have experience

play27:00

you avoid most of these problems um I'm

play27:03

just trying to think of a language where

play27:04

I I I don't have the same thing it just

play27:05

looks different you know like honestly I

play27:07

don't I don't know of a single language

play27:08

that doesn't have the exact same

play27:10

problems JavaScript has the same things

play27:12

um rust has the same thing like rust

play27:14

most certainly has it like you will find

play27:16

yourself refactoring add infinitum like

play27:19

forever you will you will refactor

play27:22

continuously in Rust if if you don't if

play27:25

it's the exact same thing you have to

play27:26

know how to do the the the rust thing

play27:29

right so like each one of them is is is

play27:31

this you know each each one of them has

play27:34

their own pain points so whatever the

play27:37

name you know what the name is

Rate This

5.0 / 5 (0 votes)

Related Tags
ゴ言語プログラミング言語比較技術者欠点ユースケースRustJavaScript言語設計開発効率エラーハンドリング
Do you need a summary in English?