WEBVTT

1
00:00:01.040 --> 00:00:03.359
<v Speaker 1>M hm hm.

2
00:00:06.400 --> 00:00:09.359
<v Speaker 2>Hello and welcome to another episode of Against and Donnett.

3
00:00:09.439 --> 00:00:11.800
<v Speaker 2>I'm Jean Clavery, your host, and with me today is

4
00:00:11.839 --> 00:00:15.400
<v Speaker 2>our special guest step On Shrines. Welcome, step On, Hey,

5
00:00:15.560 --> 00:00:19.480
<v Speaker 2>thanks for having me. Hey, thanks for coming. So I

6
00:00:19.519 --> 00:00:22.679
<v Speaker 2>think we're going to talk about source code generators today,

7
00:00:23.039 --> 00:00:25.079
<v Speaker 2>but before we get to that, why don't you tell

8
00:00:25.160 --> 00:00:27.559
<v Speaker 2>us a little bit about yourself, how you got into developed,

9
00:00:27.839 --> 00:00:30.719
<v Speaker 2>into development, and what kind of thing do you work on.

10
00:00:30.719 --> 00:00:33.960
<v Speaker 1>Now As of now, I'm a software developer at Team Sure.

11
00:00:34.200 --> 00:00:36.880
<v Speaker 1>Basically full stack developer working on dot net in the

12
00:00:36.920 --> 00:00:40.719
<v Speaker 1>back end and also the regular react type stript stack

13
00:00:40.799 --> 00:00:44.280
<v Speaker 1>in the front end. Basically I got into development kind

14
00:00:44.280 --> 00:00:48.159
<v Speaker 1>of the stayd ut rod so through university, and I

15
00:00:48.200 --> 00:00:50.439
<v Speaker 1>also had a tech background in my family. So my

16
00:00:50.960 --> 00:00:54.119
<v Speaker 1>dad is to be a system administrator at a local bank,

17
00:00:54.200 --> 00:00:57.600
<v Speaker 1>and also my mom is a project manager at the

18
00:00:57.759 --> 00:01:00.960
<v Speaker 1>at the same bank, so kind of already a pretty

19
00:01:01.000 --> 00:01:03.439
<v Speaker 1>fine puth and so I got into it basically the

20
00:01:04.840 --> 00:01:05.519
<v Speaker 1>classic crowd.

21
00:01:05.560 --> 00:01:08.400
<v Speaker 2>I would say, So some people have doctors in the family,

22
00:01:08.439 --> 00:01:10.680
<v Speaker 2>and you're just a family of developers.

23
00:01:10.719 --> 00:01:14.519
<v Speaker 1>I guess yeah. Basically, Basically I can remember my dad

24
00:01:14.799 --> 00:01:17.400
<v Speaker 1>trying to teach me C plus plus and pointers at

25
00:01:17.560 --> 00:01:20.719
<v Speaker 1>thirteen didn't quite work out, but I still managed my

26
00:01:20.799 --> 00:01:21.400
<v Speaker 1>way somehow.

27
00:01:21.879 --> 00:01:24.480
<v Speaker 2>Nice. So how'd you get into dot net?

28
00:01:24.599 --> 00:01:26.959
<v Speaker 1>Yeah, it was basically a bit of a wide ride

29
00:01:27.079 --> 00:01:30.319
<v Speaker 1>until I got there. So through university. I went to

30
00:01:30.879 --> 00:01:34.120
<v Speaker 1>university in a program which is common in Germany, where

31
00:01:34.120 --> 00:01:37.439
<v Speaker 1>you spent three months in university and three months at

32
00:01:37.640 --> 00:01:41.280
<v Speaker 1>a company, just trying to get some practical experience. And

33
00:01:41.400 --> 00:01:44.400
<v Speaker 1>basically I went through the whole cycle of C plus

34
00:01:44.400 --> 00:01:48.280
<v Speaker 1>plus phyphon, then your front and developer and some show.

35
00:01:48.560 --> 00:01:51.079
<v Speaker 1>But in the end, when I finally picked up my

36
00:01:52.200 --> 00:01:55.799
<v Speaker 1>full position, then I got into a net aspn net

37
00:01:55.799 --> 00:01:59.120
<v Speaker 1>team and that's kind of where I spent my time

38
00:01:59.159 --> 00:02:01.640
<v Speaker 1>so far. Really really like it all.

39
00:02:01.560 --> 00:02:05.760
<v Speaker 2>Right, cool, So let's talk about source code generators. Kind

40
00:02:05.799 --> 00:02:08.199
<v Speaker 2>of have to go back to the beginning of them,

41
00:02:08.400 --> 00:02:12.120
<v Speaker 2>just kind of give an introduction of what they are

42
00:02:12.159 --> 00:02:14.360
<v Speaker 2>and kind of what they're used for is because you know,

43
00:02:14.400 --> 00:02:16.800
<v Speaker 2>I've I've listened to other people talk about it, but

44
00:02:16.879 --> 00:02:18.319
<v Speaker 2>they're still very confusing to me.

45
00:02:18.599 --> 00:02:24.120
<v Speaker 1>Basically, source generators in different I just it's basically a

46
00:02:24.199 --> 00:02:26.879
<v Speaker 1>new API which came in with Dotnet five and c

47
00:02:27.039 --> 00:02:30.479
<v Speaker 1>sharp nine. So you're probably familiar with a lot of

48
00:02:30.520 --> 00:02:33.960
<v Speaker 1>approaches which we'll use ahead of this technology in order

49
00:02:34.000 --> 00:02:37.039
<v Speaker 1>to generate source code. So there was a T four

50
00:02:37.280 --> 00:02:41.520
<v Speaker 1>so text templating, and then maybe even even earlier we

51
00:02:41.800 --> 00:02:44.520
<v Speaker 1>had to set up of having post built and rebuilt

52
00:02:44.520 --> 00:02:48.199
<v Speaker 1>steps just trying to generate some some sauce which you

53
00:02:48.240 --> 00:02:51.400
<v Speaker 1>can then use within your code. And basically with this

54
00:02:51.520 --> 00:02:54.520
<v Speaker 1>new API, it's now possible to actually hook into the

55
00:02:54.560 --> 00:02:58.120
<v Speaker 1>compilation cycle of your of your project and kind of

56
00:02:58.360 --> 00:03:01.680
<v Speaker 1>also get everything set up without leaving any artifacts, so

57
00:03:01.800 --> 00:03:06.360
<v Speaker 1>without fluttering your directory with new files. And actually you

58
00:03:06.400 --> 00:03:10.000
<v Speaker 1>can also take advantage of a new thing with these

59
00:03:10.039 --> 00:03:13.240
<v Speaker 1>sauce generators, so you can basically hook into the compilation

60
00:03:13.400 --> 00:03:17.159
<v Speaker 1>and you actually get the entire past syntax three of

61
00:03:17.280 --> 00:03:21.080
<v Speaker 1>your compilation, and you're able to inspect everything in there

62
00:03:21.159 --> 00:03:23.159
<v Speaker 1>and generate code accordingly.

63
00:03:23.479 --> 00:03:25.879
<v Speaker 2>So is it kind of like the T four templates

64
00:03:26.000 --> 00:03:29.080
<v Speaker 2>it's something that you use during your development that you're

65
00:03:29.159 --> 00:03:31.439
<v Speaker 2>going to spit out some final code for you to

66
00:03:31.439 --> 00:03:33.840
<v Speaker 2>put into your project, or is it something that actually

67
00:03:33.919 --> 00:03:34.879
<v Speaker 2>can go at runtime.

68
00:03:35.080 --> 00:03:38.400
<v Speaker 1>It's somewhere in between. So T four, as you already mentioned,

69
00:03:38.439 --> 00:03:41.039
<v Speaker 1>it would actually split out code, but you would usually

70
00:03:41.039 --> 00:03:45.199
<v Speaker 1>get it in actual cs files depending on what you generate.

71
00:03:45.800 --> 00:03:48.919
<v Speaker 1>It's also not quite at one time, it's in between,

72
00:03:49.080 --> 00:03:52.680
<v Speaker 1>so it's actually happening in the compilation step. So when

73
00:03:52.719 --> 00:03:55.120
<v Speaker 1>you would go ahead and start up your compilation cycle,

74
00:03:55.680 --> 00:04:00.479
<v Speaker 1>you would basically start passing your entire code and then

75
00:04:00.599 --> 00:04:03.400
<v Speaker 1>at this point the source generator will kick in. You

76
00:04:03.439 --> 00:04:06.719
<v Speaker 1>will basically push your code at that point in time

77
00:04:06.759 --> 00:04:09.280
<v Speaker 1>so that the past artifact, you would push it to

78
00:04:09.280 --> 00:04:12.520
<v Speaker 1>the source generator. The source generator can then analyze it,

79
00:04:12.680 --> 00:04:15.199
<v Speaker 1>generate new source code, and this new source code you

80
00:04:15.319 --> 00:04:18.959
<v Speaker 1>generate will then go straight back into the compilation and

81
00:04:19.000 --> 00:04:21.800
<v Speaker 1>then the compilation will resume and at the end you

82
00:04:21.839 --> 00:04:25.639
<v Speaker 1>will obviously get your IL. So you're actually within the

83
00:04:25.639 --> 00:04:30.319
<v Speaker 1>compilation cycle, so it's not during other events before or

84
00:04:30.360 --> 00:04:32.519
<v Speaker 1>after compilation, but straight within.

85
00:04:32.839 --> 00:04:35.360
<v Speaker 2>So it's not going to kick out a CS file

86
00:04:35.439 --> 00:04:38.240
<v Speaker 2>for you. It's something that kicks out for the run

87
00:04:38.319 --> 00:04:40.319
<v Speaker 2>time to pick up and then go from there when

88
00:04:40.319 --> 00:04:41.160
<v Speaker 2>you actually run it.

89
00:04:41.160 --> 00:04:44.839
<v Speaker 1>It's possible to also emit it at a CSFI, but

90
00:04:44.920 --> 00:04:47.439
<v Speaker 1>basically it will just be there at run time. The

91
00:04:47.519 --> 00:04:51.560
<v Speaker 1>tooling is i would say a bit somewhere in between

92
00:04:51.680 --> 00:04:55.399
<v Speaker 1>right now. So if you run this generator once you

93
00:04:55.439 --> 00:04:58.600
<v Speaker 1>would usually also get intellicent support within visual Studio for

94
00:04:58.720 --> 00:05:01.199
<v Speaker 1>this because at that point and a visual studio can

95
00:05:01.240 --> 00:05:04.680
<v Speaker 1>also pick up the generated generated code and you can

96
00:05:04.720 --> 00:05:09.000
<v Speaker 1>also use it within your regular development cycle get intelligence

97
00:05:09.079 --> 00:05:12.279
<v Speaker 1>and support and whatnot. But you will not have it

98
00:05:12.360 --> 00:05:17.079
<v Speaker 1>on disc by default, so it has some varying pooling support.

99
00:05:17.160 --> 00:05:20.199
<v Speaker 1>And then it tends to feel like it's actually a

100
00:05:20.199 --> 00:05:22.439
<v Speaker 1>source file within your project, but it's not.

101
00:05:22.920 --> 00:05:25.680
<v Speaker 2>So what kind of be a basic use for it?

102
00:05:25.759 --> 00:05:27.879
<v Speaker 2>You know, with with like T four templates and things

103
00:05:27.879 --> 00:05:30.680
<v Speaker 2>like that, you're going to you build it and you

104
00:05:31.199 --> 00:05:33.199
<v Speaker 2>run it, and then quite often you have to go

105
00:05:33.279 --> 00:05:35.480
<v Speaker 2>into the generated code and make some changes to be

106
00:05:35.839 --> 00:05:38.160
<v Speaker 2>you know exactly what you want. You know, if this

107
00:05:38.240 --> 00:05:39.800
<v Speaker 2>is going to run a compile time, and I guess

108
00:05:39.839 --> 00:05:42.959
<v Speaker 2>you really have to get things exactly how you want

109
00:05:42.959 --> 00:05:45.000
<v Speaker 2>it before you run that compilation.

110
00:05:45.920 --> 00:05:50.480
<v Speaker 1>Very varying increase of how you can use this. So

111
00:05:51.040 --> 00:05:54.439
<v Speaker 1>for me personally, when I experimented with it, I kind

112
00:05:54.439 --> 00:05:57.199
<v Speaker 1>of set up a code based in which I had

113
00:05:57.240 --> 00:06:01.120
<v Speaker 1>for example, a specific interface which is inherited by some

114
00:06:01.199 --> 00:06:05.439
<v Speaker 1>example classes, and then for example, during compilation, I could

115
00:06:05.519 --> 00:06:08.879
<v Speaker 1>use the source generator and create a decorator for all

116
00:06:08.920 --> 00:06:12.879
<v Speaker 1>of these classes implementing this interface, which would then maybe

117
00:06:13.000 --> 00:06:17.480
<v Speaker 1>maybe log out something or to some additional things which

118
00:06:17.519 --> 00:06:20.680
<v Speaker 1>might be common for all of these implementers. So that's

119
00:06:20.959 --> 00:06:24.879
<v Speaker 1>maybe one use case. You can generate decorators and other

120
00:06:24.959 --> 00:06:28.240
<v Speaker 1>things like that, basically boring stuff you don't want to

121
00:06:28.240 --> 00:06:32.199
<v Speaker 1>write everywhere. Some people also use this to generate validation

122
00:06:32.360 --> 00:06:36.439
<v Speaker 1>code on the fly based on some metadata, so for example,

123
00:06:36.480 --> 00:06:38.920
<v Speaker 1>you put some attributes on your classes or on your

124
00:06:38.920 --> 00:06:43.079
<v Speaker 1>methods and you can generate a validation on the fly.

125
00:06:43.399 --> 00:06:48.120
<v Speaker 1>I think it's also really used a lot already within

126
00:06:48.240 --> 00:06:52.399
<v Speaker 1>aspn net, and some dependency injection frameworks already picked us

127
00:06:52.480 --> 00:06:56.120
<v Speaker 1>up because being able to inspect the compilation three on

128
00:06:56.720 --> 00:07:00.480
<v Speaker 1>the fly, you can, for example, as a dependency injection framework,

129
00:07:00.519 --> 00:07:03.839
<v Speaker 1>instead of relying on reflection at runtime, you can also

130
00:07:04.120 --> 00:07:07.879
<v Speaker 1>take a look at the code during the compilation and

131
00:07:07.959 --> 00:07:11.720
<v Speaker 1>basically see which losses need which dependency, and instead of

132
00:07:11.759 --> 00:07:15.360
<v Speaker 1>generating your dependencies at runtime, you can then already make

133
00:07:15.439 --> 00:07:17.959
<v Speaker 1>use of it and have a look at this and

134
00:07:18.120 --> 00:07:19.839
<v Speaker 1>during the compilation cycle.

135
00:07:19.959 --> 00:07:23.680
<v Speaker 2>Okay, so what's the first thing to know to get started?

136
00:07:23.759 --> 00:07:26.959
<v Speaker 2>You know, writing your first source code generator but there.

137
00:07:26.800 --> 00:07:30.240
<v Speaker 1>Are basically some constraints right now. The biggest one is

138
00:07:30.279 --> 00:07:34.000
<v Speaker 1>probably that the project containing the Sauce generator needs to

139
00:07:34.000 --> 00:07:37.439
<v Speaker 1>be Donut Standard two dot zero, so it's not yet

140
00:07:37.480 --> 00:07:41.519
<v Speaker 1>on a Net five. That's basically a constraint of how

141
00:07:41.560 --> 00:07:46.399
<v Speaker 1>the Rosslyn compiler, which the source generators originally come from,

142
00:07:46.959 --> 00:07:49.560
<v Speaker 1>is allowed to run. And then basically you need a

143
00:07:49.600 --> 00:07:53.360
<v Speaker 1>set up containing of one project which hosts the generator,

144
00:07:53.639 --> 00:07:55.639
<v Speaker 1>and then you will probably want to consume it from

145
00:07:55.680 --> 00:08:00.879
<v Speaker 1>another project. So within a project containing the generator, you

146
00:08:00.959 --> 00:08:04.879
<v Speaker 1>basically need to import two packages, which is the Microsoft

147
00:08:04.959 --> 00:08:09.240
<v Speaker 1>COUTE Analysis c Shop and Microsoft COUDE Analysis Analyzer. And

148
00:08:09.279 --> 00:08:12.160
<v Speaker 1>then within the project you want to reference it, you

149
00:08:12.199 --> 00:08:15.839
<v Speaker 1>would have the Microsoft dot net dot Compilers dot tool set,

150
00:08:16.079 --> 00:08:19.680
<v Speaker 1>a package that will also bring in some intelligence magic.

151
00:08:20.040 --> 00:08:24.000
<v Speaker 1>And then basically within the reference to this source generator,

152
00:08:24.439 --> 00:08:27.720
<v Speaker 1>you would also have to put some specific text like

153
00:08:27.920 --> 00:08:32.039
<v Speaker 1>output item type analyzer, and it's basically a bit of

154
00:08:32.080 --> 00:08:36.720
<v Speaker 1>a setup, but that's really much standard. And then once

155
00:08:36.759 --> 00:08:39.840
<v Speaker 1>you do that, you can basically just create a glass,

156
00:08:40.039 --> 00:08:43.120
<v Speaker 1>put a generator attribute on top of it and make

157
00:08:43.159 --> 00:08:46.639
<v Speaker 1>it inherit Thesaurce Generator interface and that's basically it it

158
00:08:46.639 --> 00:08:48.919
<v Speaker 1>sounds a bit more complicated than it actually is in

159
00:08:48.960 --> 00:08:52.120
<v Speaker 1>the end, so it's actually really easy just taking a

160
00:08:52.159 --> 00:08:55.200
<v Speaker 1>look at the dogs and then getting everything set up

161
00:08:55.639 --> 00:08:58.639
<v Speaker 1>and then actually it works quite well out of the box.

162
00:08:58.799 --> 00:09:00.279
<v Speaker 2>So does it take writing a lot a lot of

163
00:09:00.320 --> 00:09:04.159
<v Speaker 2>code to get something that's going to generate code for you?

164
00:09:04.240 --> 00:09:06.679
<v Speaker 2>And you know sometimes you know you might be spending

165
00:09:06.720 --> 00:09:09.720
<v Speaker 2>more time writing the generator than what you spent writing

166
00:09:09.759 --> 00:09:10.480
<v Speaker 2>the code itself.

167
00:09:10.720 --> 00:09:13.840
<v Speaker 1>It depends on the usage, I would say. So basically

168
00:09:13.840 --> 00:09:17.240
<v Speaker 1>a source generator it always works in two steps. So

169
00:09:17.360 --> 00:09:20.879
<v Speaker 1>there's an initialized method, and within this method you can,

170
00:09:20.919 --> 00:09:27.200
<v Speaker 1>for example, register your code to respond to syntax node notifications.

171
00:09:27.240 --> 00:09:30.279
<v Speaker 1>So whenever the compiler picks up something new, you would

172
00:09:30.639 --> 00:09:33.639
<v Speaker 1>have this event pushed to your sauce generator and you

173
00:09:33.679 --> 00:09:37.399
<v Speaker 1>can maybe already analyze all the notes whether they fulfill

174
00:09:37.519 --> 00:09:40.080
<v Speaker 1>some constraint. But if you don't need this, and you

175
00:09:40.240 --> 00:09:43.720
<v Speaker 1>only decide okay, I just want to generate code, that

176
00:09:43.919 --> 00:09:47.039
<v Speaker 1>usually happens in the execute step of the generator, and

177
00:09:47.159 --> 00:09:50.240
<v Speaker 1>within there, basically all you have to do is, just

178
00:09:50.480 --> 00:09:54.679
<v Speaker 1>as with regular code generation, create a string builder and

179
00:09:55.200 --> 00:09:57.879
<v Speaker 1>there you can write your C sharp code and that's

180
00:09:57.919 --> 00:10:00.039
<v Speaker 1>it already. So if you don't need any super a

181
00:10:00.320 --> 00:10:03.480
<v Speaker 1>special setup, you can just have your string builder create

182
00:10:03.519 --> 00:10:06.399
<v Speaker 1>a c shop class and you're good to go already.

183
00:10:06.639 --> 00:10:08.960
<v Speaker 2>Okay, so is it kind of like using a string builder.

184
00:10:09.519 --> 00:10:11.919
<v Speaker 2>You pass in some tokens and things like that you

185
00:10:11.960 --> 00:10:15.120
<v Speaker 2>want to be replaced in that string as it compiles,

186
00:10:15.159 --> 00:10:17.159
<v Speaker 2>and then that'll kick out the code for.

187
00:10:17.159 --> 00:10:23.320
<v Speaker 1>You, essentially usually a very clorified string interpulation, and that's

188
00:10:23.360 --> 00:10:26.279
<v Speaker 1>basically all there. So that's what you would mostly also

189
00:10:26.399 --> 00:10:26.879
<v Speaker 1>end up with.

190
00:10:27.240 --> 00:10:29.200
<v Speaker 2>Okay, Yeah, that makes a lot more sense to me

191
00:10:29.279 --> 00:10:30.759
<v Speaker 2>now that I think about it that way. It's just

192
00:10:30.799 --> 00:10:34.159
<v Speaker 2>something that's going to basically take a snippet or templative

193
00:10:34.200 --> 00:10:38.120
<v Speaker 2>code that you have, and then I guess somewhere in

194
00:10:38.159 --> 00:10:40.720
<v Speaker 2>your main code you put you know, like you said,

195
00:10:40.799 --> 00:10:44.679
<v Speaker 2>you're use an attribute or something like that to set it,

196
00:10:44.759 --> 00:10:47.440
<v Speaker 2>and then in that attribute you pass in the things

197
00:10:47.440 --> 00:10:49.759
<v Speaker 2>that are going to replace get replaced in that string builder.

198
00:10:50.000 --> 00:10:53.600
<v Speaker 1>That's actually the beauty of it. You can basically put

199
00:10:54.039 --> 00:10:57.879
<v Speaker 1>anything anywhere, and since you get the complete syntax tree

200
00:10:58.000 --> 00:11:00.799
<v Speaker 1>of your program, you can analyze every thing, so it

201
00:11:00.840 --> 00:11:03.399
<v Speaker 1>doesn't even have to be an attribute. You can also

202
00:11:03.559 --> 00:11:08.960
<v Speaker 1>inspect interfaces, check whether interfaces fulfill a specific name or

203
00:11:08.960 --> 00:11:12.879
<v Speaker 1>whether they also implement other interfaces on top. Usually an

204
00:11:13.000 --> 00:11:15.919
<v Speaker 1>attribute is a good idea, I would say, because that's

205
00:11:16.320 --> 00:11:19.720
<v Speaker 1>especially designed to represent some metadata. So that's a good

206
00:11:19.759 --> 00:11:23.600
<v Speaker 1>approach in my opinion. But you're definitely not constrained to attributes.

207
00:11:23.679 --> 00:11:26.840
<v Speaker 1>You can mix and match as you want. So basically

208
00:11:26.879 --> 00:11:27.080
<v Speaker 1>you have.

209
00:11:27.200 --> 00:11:30.559
<v Speaker 2>It build a class. That class doesn't exist at the

210
00:11:30.559 --> 00:11:32.879
<v Speaker 2>time that you're actually doing your development. So how does

211
00:11:32.919 --> 00:11:35.759
<v Speaker 2>the other part of your code know that that's going

212
00:11:35.840 --> 00:11:37.440
<v Speaker 2>to be there when you compile.

213
00:11:37.799 --> 00:11:41.320
<v Speaker 1>That's actually a bit difficult now, So I think I

214
00:11:41.360 --> 00:11:44.519
<v Speaker 1>already mentioned that the tooling support can feel a bit

215
00:11:44.600 --> 00:11:48.919
<v Speaker 1>off here and there. Usually it might take one cycle

216
00:11:49.039 --> 00:11:52.919
<v Speaker 1>of building the source generator, for example visual studio to

217
00:11:52.960 --> 00:11:55.519
<v Speaker 1>pick up the generated files at least, and then at

218
00:11:55.559 --> 00:11:58.039
<v Speaker 1>least visual Studio can give you a bit of a

219
00:11:58.120 --> 00:12:01.360
<v Speaker 1>hand with the generated code and also give you some

220
00:12:01.440 --> 00:12:05.039
<v Speaker 1>intelligence on top. But sometimes, for example, if you create

221
00:12:05.080 --> 00:12:07.399
<v Speaker 1>a new generator and you never had it run before,

222
00:12:07.600 --> 00:12:11.399
<v Speaker 1>then it can feel like you basically want to use

223
00:12:11.399 --> 00:12:14.840
<v Speaker 1>that glass, but intelligence just acts as if this would

224
00:12:14.879 --> 00:12:17.879
<v Speaker 1>not exist, which it actually doesn't at disappoint So yes,

225
00:12:18.200 --> 00:12:20.799
<v Speaker 1>tooling is a bit off, but I hope the visional

226
00:12:20.840 --> 00:12:25.080
<v Speaker 1>studio experience, and I personally don't know how it behaves

227
00:12:25.080 --> 00:12:27.480
<v Speaker 1>in writer, but I guess they would also have picked

228
00:12:27.480 --> 00:12:30.600
<v Speaker 1>it up by now. So that part is usually entirely

229
00:12:30.600 --> 00:12:33.399
<v Speaker 1>on the ide and depending on the support, it can

230
00:12:33.480 --> 00:12:37.159
<v Speaker 1>feel good or mediocre, but usually you can get by

231
00:12:37.320 --> 00:12:38.320
<v Speaker 1>really pretty fine.

232
00:12:38.320 --> 00:12:40.759
<v Speaker 2>I would say so in that in that string builder,

233
00:12:40.799 --> 00:12:43.279
<v Speaker 2>you know, as as you're building that telling it what

234
00:12:43.600 --> 00:12:46.799
<v Speaker 2>the code you want to output, can it see into

235
00:12:46.879 --> 00:12:50.000
<v Speaker 2>that code that you're building so you can get intelligence

236
00:12:50.039 --> 00:12:51.840
<v Speaker 2>and code validation and things like that.

237
00:12:52.120 --> 00:12:55.039
<v Speaker 1>Not entirely sure, to be honest, I think there's also

238
00:12:55.080 --> 00:12:56.879
<v Speaker 1>some tooling in that direction.

239
00:12:57.080 --> 00:12:59.399
<v Speaker 2>I mean, can you do something like like a razor file,

240
00:12:59.600 --> 00:13:02.720
<v Speaker 2>but be be the template of the code that you

241
00:13:02.759 --> 00:13:03.360
<v Speaker 2>want to use?

242
00:13:04.519 --> 00:13:06.720
<v Speaker 1>I think I read up a bit. There are some

243
00:13:06.879 --> 00:13:10.399
<v Speaker 1>extensions which also look into solving that problem, but I

244
00:13:10.440 --> 00:13:12.840
<v Speaker 1>think out of the boxes is sadly not possible. Not

245
00:13:13.120 --> 00:13:15.919
<v Speaker 1>so you would kind of have to know where your

246
00:13:16.039 --> 00:13:19.559
<v Speaker 1>classes are because in the end, when you create a

247
00:13:19.559 --> 00:13:22.840
<v Speaker 1>string which should then contain like a complete class, you

248
00:13:22.840 --> 00:13:26.360
<v Speaker 1>would also have to take care of using namespaces and

249
00:13:26.559 --> 00:13:31.320
<v Speaker 1>everything around that. So that's definitely something which feels a

250
00:13:31.320 --> 00:13:33.960
<v Speaker 1>bit difficult sometimes because you'll have to remember all of

251
00:13:34.000 --> 00:13:36.519
<v Speaker 1>these things, all of these boiler plate things you would

252
00:13:36.519 --> 00:13:37.720
<v Speaker 1>also have to add on top.

253
00:13:37.919 --> 00:13:40.200
<v Speaker 2>Yeah, because if it did something like in a razor

254
00:13:40.240 --> 00:13:42.200
<v Speaker 2>file or something like that, where you could just do

255
00:13:42.320 --> 00:13:45.440
<v Speaker 2>all your loops right within the little template to build

256
00:13:45.440 --> 00:13:48.000
<v Speaker 2>it all up as the final string that you're trying

257
00:13:48.039 --> 00:13:50.240
<v Speaker 2>to replace into your code, that would make it pretty

258
00:13:50.240 --> 00:13:51.639
<v Speaker 2>easy to work with. I think.

259
00:13:51.919 --> 00:13:55.559
<v Speaker 1>In on that end, you can basically also just push

260
00:13:55.960 --> 00:13:58.759
<v Speaker 1>a part of your class to the string builder, and

261
00:13:58.799 --> 00:14:01.200
<v Speaker 1>then you can fall back to the regularly shop code

262
00:14:01.440 --> 00:14:04.000
<v Speaker 1>and just for example, inside a loop which would then

263
00:14:04.639 --> 00:14:08.320
<v Speaker 1>continuously append lines to the to the string builder, you're

264
00:14:08.320 --> 00:14:10.840
<v Speaker 1>also not constrained to the string builder at all. You

265
00:14:10.879 --> 00:14:14.320
<v Speaker 1>can also just use a very big interpolatest string with

266
00:14:14.320 --> 00:14:16.559
<v Speaker 1>with the ad at the beginning to make it work

267
00:14:16.559 --> 00:14:21.200
<v Speaker 1>across lines, and you're really free to model that however

268
00:14:21.279 --> 00:14:21.960
<v Speaker 1>you want.

269
00:14:22.200 --> 00:14:25.440
<v Speaker 2>Do you find yourself creating these source code generators a

270
00:14:25.480 --> 00:14:27.799
<v Speaker 2>lot for different projects? You know, I'm trying to I'm

271
00:14:27.799 --> 00:14:29.519
<v Speaker 2>trying to take up a case where you know, I

272
00:14:29.600 --> 00:14:34.840
<v Speaker 2>really needed that that much other than like generating entities

273
00:14:34.879 --> 00:14:37.519
<v Speaker 2>and things like that, where you know, Visus code Visus

274
00:14:37.519 --> 00:14:40.159
<v Speaker 2>Studio is already going to help you out building those,

275
00:14:40.679 --> 00:14:43.159
<v Speaker 2>just like a T four templeate does. So when would

276
00:14:43.200 --> 00:14:45.639
<v Speaker 2>you use a source code generator and when would you

277
00:14:45.720 --> 00:14:48.159
<v Speaker 2>use something right like a T four template.

278
00:14:48.399 --> 00:14:52.200
<v Speaker 1>I think there's a very big distinction. With T four templates,

279
00:14:52.240 --> 00:14:55.639
<v Speaker 1>you're usually constrained to Visual Studio because I think they're

280
00:14:56.240 --> 00:14:59.559
<v Speaker 1>much tied to that I d e. And with the

281
00:14:59.600 --> 00:15:03.960
<v Speaker 1>software generators, you're actually running within Rosslyn, so within a compiler,

282
00:15:04.039 --> 00:15:06.919
<v Speaker 1>so you can also have it running on Linux or

283
00:15:06.960 --> 00:15:09.840
<v Speaker 1>wherever you want, So that's a big difference. I would

284
00:15:09.840 --> 00:15:12.879
<v Speaker 1>say you're very much free to use it wherever you want.

285
00:15:13.039 --> 00:15:15.360
<v Speaker 1>When it comes to actual examples where I used this,

286
00:15:15.519 --> 00:15:18.159
<v Speaker 1>So actually I had a use case for this a

287
00:15:18.159 --> 00:15:21.480
<v Speaker 1>while ago. So at work, we have an older project.

288
00:15:21.480 --> 00:15:24.960
<v Speaker 1>It's C plus plus cli. Maybe that rings a bell.

289
00:15:25.279 --> 00:15:28.440
<v Speaker 1>It's it's a bit engined, and basically we have some

290
00:15:28.679 --> 00:15:32.080
<v Speaker 1>definitions in there which we wanted to translate to completely

291
00:15:32.120 --> 00:15:36.519
<v Speaker 1>manage the code models. And basically I also got started

292
00:15:36.559 --> 00:15:39.679
<v Speaker 1>with this by using it as as a post built step,

293
00:15:39.759 --> 00:15:43.759
<v Speaker 1>you know, the old wave generating code. But I mean

294
00:15:44.279 --> 00:15:48.279
<v Speaker 1>in my case, it was pretty simple colleagues started complaining

295
00:15:48.320 --> 00:15:50.720
<v Speaker 1>at some point that I was just generating way too

296
00:15:50.720 --> 00:15:54.120
<v Speaker 1>many files with that, because I created a file for

297
00:15:54.399 --> 00:15:56.399
<v Speaker 1>definitions and there are quite a lot of them in

298
00:15:56.440 --> 00:15:59.399
<v Speaker 1>that project. And then I thought, okay, this might be

299
00:15:59.399 --> 00:16:02.279
<v Speaker 1>a good use is for a source generator, and then

300
00:16:02.519 --> 00:16:06.399
<v Speaker 1>I did that, and it even worked flawlessly, even if

301
00:16:06.639 --> 00:16:09.360
<v Speaker 1>in a dot Net framework code base, so not even

302
00:16:09.399 --> 00:16:12.519
<v Speaker 1>if dont five. That's probably more of a convenience thing

303
00:16:12.840 --> 00:16:16.559
<v Speaker 1>because there's like no technical reason to have a source

304
00:16:16.600 --> 00:16:19.480
<v Speaker 1>generator there. But I think I think I already talked

305
00:16:19.480 --> 00:16:23.200
<v Speaker 1>about it a bit. There are some use cases, especially

306
00:16:23.240 --> 00:16:27.200
<v Speaker 1>within dot net frameworks, which are very much focused on performance,

307
00:16:27.200 --> 00:16:30.120
<v Speaker 1>so ASPNAT is a prime use case for this. They

308
00:16:30.159 --> 00:16:32.960
<v Speaker 1>already tried to move a lot of the code which

309
00:16:32.960 --> 00:16:36.320
<v Speaker 1>they would usually use reflection for at run time and

310
00:16:36.720 --> 00:16:39.440
<v Speaker 1>try to convert it to a source generator, especially if

311
00:16:39.440 --> 00:16:44.399
<v Speaker 1>the information they would try to process through reflection is

312
00:16:44.399 --> 00:16:47.679
<v Speaker 1>already available at compilation time, just to shape of that

313
00:16:47.919 --> 00:16:51.120
<v Speaker 1>extra bit of performance during one time. I think that's

314
00:16:51.159 --> 00:16:53.960
<v Speaker 1>a pretty big use case where this is already used

315
00:16:54.000 --> 00:16:54.279
<v Speaker 1>a lot.

316
00:16:54.639 --> 00:16:57.200
<v Speaker 2>So I think people like me, being kind of being

317
00:16:57.320 --> 00:16:59.799
<v Speaker 2>old school, the first thing I would go to is

318
00:16:59.840 --> 00:17:02.720
<v Speaker 2>just make make a copy of something that I want

319
00:17:02.759 --> 00:17:05.079
<v Speaker 2>and then I just copy and paste to make all

320
00:17:05.119 --> 00:17:07.279
<v Speaker 2>the little changes and things like that, rather than going

321
00:17:07.319 --> 00:17:11.079
<v Speaker 2>to lassole writing a source code generator. Do you really

322
00:17:11.160 --> 00:17:13.599
<v Speaker 2>have to get something that really has to be used

323
00:17:13.640 --> 00:17:16.160
<v Speaker 2>over and over again? And can you can you write

324
00:17:16.200 --> 00:17:19.480
<v Speaker 2>this generator and then share it between different projects.

325
00:17:19.640 --> 00:17:23.079
<v Speaker 1>That's actually possible. So it's a bit difficult because I

326
00:17:23.079 --> 00:17:26.000
<v Speaker 1>think I already mentioned that source code generators are kind

327
00:17:26.039 --> 00:17:28.920
<v Speaker 1>of constrained to dot Net standard to zero right now.

328
00:17:29.359 --> 00:17:32.599
<v Speaker 1>So that was definitely a bit of a surprise when

329
00:17:32.640 --> 00:17:36.720
<v Speaker 1>I started getting into that technology, because, as with any

330
00:17:37.039 --> 00:17:41.079
<v Speaker 1>good citizen, I already upgraded my projects to dot Net

331
00:17:41.079 --> 00:17:44.240
<v Speaker 1>five at disappoint and I basically wanted to have the

332
00:17:44.680 --> 00:17:48.599
<v Speaker 1>generator use some some specific names of some types, and

333
00:17:48.640 --> 00:17:51.000
<v Speaker 1>then I noticed you can't reference it from a dot

334
00:17:51.039 --> 00:17:54.000
<v Speaker 1>net standard project. You can't add a reference to dot

335
00:17:54.000 --> 00:17:56.079
<v Speaker 1>net five. So that was a bit of a shocker.

336
00:17:56.279 --> 00:17:58.559
<v Speaker 1>So that's a constraint do you have to keep in

337
00:17:58.599 --> 00:18:01.880
<v Speaker 1>mind when you try to share these source generators, But

338
00:18:02.000 --> 00:18:05.920
<v Speaker 1>otherwise it's it's definitely possible, and if you already use

339
00:18:06.000 --> 00:18:09.680
<v Speaker 1>the new cspproach format. So the one coming in with

340
00:18:09.799 --> 00:18:13.559
<v Speaker 1>dot net standard, you would also get this source generator

341
00:18:13.559 --> 00:18:17.519
<v Speaker 1>output as a transitive dependency. So, for example, if you

342
00:18:17.599 --> 00:18:22.680
<v Speaker 1>have a source generator project which is referenced by another project,

343
00:18:22.720 --> 00:18:25.160
<v Speaker 1>and then you would transitively add a reference to that

344
00:18:25.240 --> 00:18:30.119
<v Speaker 1>project from somewhere else, you would get these generated definitions everywhere.

345
00:18:30.279 --> 00:18:32.319
<v Speaker 1>And that's already a nice way to share it. But

346
00:18:32.440 --> 00:18:35.880
<v Speaker 1>besides that, you're also very much free to reference it

347
00:18:35.920 --> 00:18:38.720
<v Speaker 1>from somewhere else. That's just one thing to keep in

348
00:18:38.759 --> 00:18:42.319
<v Speaker 1>mind because if you reference it from multiple positions in

349
00:18:42.359 --> 00:18:45.519
<v Speaker 1>your code, and you reference it in a way which

350
00:18:45.680 --> 00:18:48.960
<v Speaker 1>triggers the source generator to actually generate them some source,

351
00:18:49.359 --> 00:18:52.240
<v Speaker 1>then it's also pretty easy to end up with double

352
00:18:52.319 --> 00:18:57.039
<v Speaker 1>generations and you basically then have two conflicting types because

353
00:18:57.079 --> 00:19:01.160
<v Speaker 1>the generator run twice, and that's what you have a

354
00:19:01.200 --> 00:19:02.200
<v Speaker 1>new project in the end.

355
00:19:02.440 --> 00:19:05.240
<v Speaker 2>Oh wow, yeah, that's kind of a good gotcha there?

356
00:19:05.319 --> 00:19:08.000
<v Speaker 2>So all right, so don't there are two point zero

357
00:19:08.039 --> 00:19:10.200
<v Speaker 2>So it's not in net six either.

358
00:19:10.200 --> 00:19:13.119
<v Speaker 1>Not yet, sadly. Actually, I also reached out to the

359
00:19:13.400 --> 00:19:16.720
<v Speaker 1>to the Rossland team on the c sharp discord channel,

360
00:19:16.960 --> 00:19:19.200
<v Speaker 1>and as much as I would, they would like to

361
00:19:19.240 --> 00:19:21.400
<v Speaker 1>do it. As of now, it seems like they are

362
00:19:21.440 --> 00:19:26.960
<v Speaker 1>constrained by the support. So dot net framework projects also

363
00:19:27.200 --> 00:19:30.319
<v Speaker 1>support these source generators. So basically, as of now, the

364
00:19:30.440 --> 00:19:32.960
<v Speaker 1>best way they can do this is with dot net standard,

365
00:19:33.039 --> 00:19:35.839
<v Speaker 1>because you can consume dot net standard from dot net

366
00:19:35.880 --> 00:19:38.960
<v Speaker 1>framework projects and dot Net five or dot Net six

367
00:19:39.039 --> 00:19:42.839
<v Speaker 1>projects alike. I am sadly not aware of whether there

368
00:19:42.839 --> 00:19:45.920
<v Speaker 1>are any plans to also make it possible to reference

369
00:19:46.279 --> 00:19:50.000
<v Speaker 1>dot net six projects because that's currently a bit of

370
00:19:50.000 --> 00:19:53.880
<v Speaker 1>a paint point. Definitely, if you want to just even

371
00:19:53.880 --> 00:19:55.559
<v Speaker 1>if you just want to get a name of the

372
00:19:55.680 --> 00:19:58.799
<v Speaker 1>type you would want to check against this compilation three,

373
00:19:59.400 --> 00:20:00.680
<v Speaker 1>then it's a of a hassle.

374
00:20:00.880 --> 00:20:04.480
<v Speaker 2>Yeah, so I'm being done in stented two point zero only.

375
00:20:04.839 --> 00:20:06.240
<v Speaker 2>You know, I think that could be kind of a

376
00:20:06.279 --> 00:20:09.559
<v Speaker 2>discouragement for getting people to start using them. It's a

377
00:20:09.599 --> 00:20:13.000
<v Speaker 2>new feature, but if they're not bringing it forward that much,

378
00:20:13.079 --> 00:20:17.279
<v Speaker 2>then people go, well, it's probably going to get abandoned

379
00:20:17.359 --> 00:20:20.759
<v Speaker 2>and deprecated at some point in time, so why should

380
00:20:20.759 --> 00:20:21.400
<v Speaker 2>I use it.

381
00:20:21.400 --> 00:20:25.200
<v Speaker 1>It's definitely a good point, but basically it's also not

382
00:20:25.359 --> 00:20:29.160
<v Speaker 1>as bad as it might sound. So this whole generation step,

383
00:20:29.200 --> 00:20:32.079
<v Speaker 1>I think you already talked about how the generation would

384
00:20:32.119 --> 00:20:34.640
<v Speaker 1>create a syntax three for you, and you can then

385
00:20:34.720 --> 00:20:37.720
<v Speaker 1>analyze the syntax three. It's a bit difference. It's a

386
00:20:37.720 --> 00:20:41.359
<v Speaker 1>bit of a difference than with reflection because, for example,

387
00:20:41.400 --> 00:20:44.240
<v Speaker 1>with reflection, you would also just go ahead and try

388
00:20:44.240 --> 00:20:48.400
<v Speaker 1>to compare types or assemblies, and the syntax tree is

389
00:20:48.440 --> 00:20:52.359
<v Speaker 1>basically one layer above, so you're not dealing with types

390
00:20:52.400 --> 00:20:55.119
<v Speaker 1>at all, and you would usually just do it with

391
00:20:55.759 --> 00:20:59.839
<v Speaker 1>either strings or you actually try to model your sauce

392
00:21:00.000 --> 00:21:02.880
<v Speaker 1>generator in a way which can easily work with all

393
00:21:02.920 --> 00:21:06.200
<v Speaker 1>of these syntax notes. So it's not as bad as

394
00:21:06.240 --> 00:21:09.759
<v Speaker 1>it sounds, to be honest, and usually the benefits kind

395
00:21:09.799 --> 00:21:13.519
<v Speaker 1>of outweigh the drawbacks. So I'm also hoping and I'm

396
00:21:13.599 --> 00:21:17.480
<v Speaker 1>rooting for some improvements in that regard, especially when it

397
00:21:17.480 --> 00:21:21.119
<v Speaker 1>comes to support for neo dot net versions. But as

398
00:21:21.119 --> 00:21:23.920
<v Speaker 1>of now, it is also not really big deal to

399
00:21:24.000 --> 00:21:24.599
<v Speaker 1>me at least.

400
00:21:24.799 --> 00:21:29.000
<v Speaker 2>Okay, okay, so what are the limitations of what you

401
00:21:29.039 --> 00:21:31.720
<v Speaker 2>can do what you can't do? So talk about some

402
00:21:31.920 --> 00:21:35.480
<v Speaker 2>things that you've learned using them that you would have

403
00:21:36.000 --> 00:21:38.200
<v Speaker 2>liked to have known when you first got started.

404
00:21:38.319 --> 00:21:42.440
<v Speaker 1>There's a really big thing which I was definitely caught

405
00:21:42.440 --> 00:21:45.400
<v Speaker 1>a bit of guard with. So as a person which

406
00:21:45.839 --> 00:21:50.400
<v Speaker 1>did not yet use any Rosslyn APIs before. So Rosslyn

407
00:21:50.480 --> 00:21:54.119
<v Speaker 1>being the c shop compiler which also provides these source generators.

408
00:21:54.519 --> 00:21:58.400
<v Speaker 1>They also power a lot of the suggestions within for example,

409
00:21:58.480 --> 00:22:03.200
<v Speaker 1>visuous studio for syntax improvements. So just this thing of

410
00:22:03.680 --> 00:22:07.839
<v Speaker 1>source analyzing is not a new topic coming to Rossland,

411
00:22:08.319 --> 00:22:10.960
<v Speaker 1>and they already seem to have a very established way

412
00:22:11.039 --> 00:22:14.279
<v Speaker 1>of how you can inspect the syntax tree, which is

413
00:22:14.519 --> 00:22:17.200
<v Speaker 1>very hard to get into as a as a beginner.

414
00:22:17.400 --> 00:22:22.359
<v Speaker 1>And there's a very useful addition extension for a visual

415
00:22:22.400 --> 00:22:26.640
<v Speaker 1>studio which is called Syntax Visualizer, and it basically allows

416
00:22:26.680 --> 00:22:30.359
<v Speaker 1>you to step into your class and on the side

417
00:22:30.359 --> 00:22:34.960
<v Speaker 1>you have a very nice window which generates your class

418
00:22:34.799 --> 00:22:38.200
<v Speaker 1>as a syntax tree, and that way you can easily

419
00:22:38.240 --> 00:22:41.519
<v Speaker 1>trace how you would also receive the syntax tree within

420
00:22:41.559 --> 00:22:44.799
<v Speaker 1>your source generator and that makes it way easier to

421
00:22:45.400 --> 00:22:48.519
<v Speaker 1>figure out which nodes do I need to check, which

422
00:22:48.559 --> 00:22:52.200
<v Speaker 1>note will represent my interface, which note will represent my

423
00:22:52.240 --> 00:22:55.839
<v Speaker 1>allocation in this case, So this is something which is

424
00:22:56.160 --> 00:22:59.880
<v Speaker 1>very useful to know ahead. Also this features available on

425
00:23:00.079 --> 00:23:03.799
<v Speaker 1>sharp lab io. You can also change the result on

426
00:23:03.880 --> 00:23:06.279
<v Speaker 1>sharp lab io from for example, the shop to a

427
00:23:06.279 --> 00:23:09.880
<v Speaker 1>syntax tree, and this is definitely something to keep in

428
00:23:09.920 --> 00:23:14.000
<v Speaker 1>mind because that will be probably the topic which people

429
00:23:14.039 --> 00:23:17.480
<v Speaker 1>will have the most trouble getting into. It's definitely a

430
00:23:17.519 --> 00:23:21.400
<v Speaker 1>different domain than reflection with types.

431
00:23:21.720 --> 00:23:24.200
<v Speaker 2>What other things should we talk about about source code

432
00:23:24.279 --> 00:23:25.839
<v Speaker 2>generators that we haven't covered.

433
00:23:26.079 --> 00:23:28.880
<v Speaker 1>I think we've already got through most of what I

434
00:23:28.920 --> 00:23:33.240
<v Speaker 1>think is important, So I think the most important thing

435
00:23:33.319 --> 00:23:35.799
<v Speaker 1>to keep in mind that is how all you can

436
00:23:35.839 --> 00:23:39.720
<v Speaker 1>set it up, which constraint it still has, which SDK

437
00:23:40.000 --> 00:23:43.160
<v Speaker 1>version it can run on, And I think I mentioned

438
00:23:43.160 --> 00:23:46.640
<v Speaker 1>it right right away, the syntax three. The syntax three

439
00:23:46.680 --> 00:23:49.279
<v Speaker 1>details which are definitely a bit harder to get into.

440
00:23:50.039 --> 00:23:53.880
<v Speaker 1>I think. Besides that, something which is also something new

441
00:23:53.960 --> 00:23:57.000
<v Speaker 1>you have to wrap your head around, is coming to

442
00:23:57.119 --> 00:24:01.319
<v Speaker 1>grips with how these source generators actually work, getting away

443
00:24:01.359 --> 00:24:05.039
<v Speaker 1>from the THOUGHD model of having code generation ahead of

444
00:24:05.079 --> 00:24:08.480
<v Speaker 1>the compilation or at run time, but rather right within

445
00:24:08.519 --> 00:24:12.359
<v Speaker 1>the compilation. That's also something to keep in mind here

446
00:24:12.759 --> 00:24:15.960
<v Speaker 1>and decides that. Honestly, I think that the technology is

447
00:24:16.000 --> 00:24:20.039
<v Speaker 1>really nice and it's it's definitely something which kind of

448
00:24:20.079 --> 00:24:22.640
<v Speaker 1>becomes what you make out of it, so there are

449
00:24:22.680 --> 00:24:25.519
<v Speaker 1>not a lot of constraints as to what this thing

450
00:24:25.640 --> 00:24:28.599
<v Speaker 1>can do for you, and that's probably more of a

451
00:24:28.640 --> 00:24:30.279
<v Speaker 1>stretch of imagination.

452
00:24:29.880 --> 00:24:33.359
<v Speaker 2>Than Okay, so have they been making enhancements to source

453
00:24:33.359 --> 00:24:36.839
<v Speaker 2>code generators over time or they kind of just kind

454
00:24:36.839 --> 00:24:39.359
<v Speaker 2>of have everything there they think they need and it's

455
00:24:39.640 --> 00:24:42.200
<v Speaker 2>it's going to be going to be there. Are they

456
00:24:42.240 --> 00:24:46.519
<v Speaker 2>going to you know, make have things changed in the future.

457
00:24:45.759 --> 00:24:50.000
<v Speaker 1>Have been changes already. I think when source generators started out,

458
00:24:50.359 --> 00:24:53.640
<v Speaker 1>they were also similar to T four Visual Studio only think,

459
00:24:54.000 --> 00:24:57.160
<v Speaker 1>which already was improved on with dot Net five. I'm

460
00:24:57.200 --> 00:25:00.680
<v Speaker 1>not entirely sure what changed with dot net six. To me,

461
00:25:00.799 --> 00:25:05.160
<v Speaker 1>it still feels as if the technology is it's great,

462
00:25:05.319 --> 00:25:09.000
<v Speaker 1>it's very useful, but it's also at the same time

463
00:25:09.160 --> 00:25:12.839
<v Speaker 1>something which feels like was mostly developed for internal uses,

464
00:25:13.319 --> 00:25:17.119
<v Speaker 1>and I think as of now it's also the main target,

465
00:25:17.519 --> 00:25:20.720
<v Speaker 1>the target audience for this technology, So I'm not sure.

466
00:25:21.359 --> 00:25:23.559
<v Speaker 1>I hope there will be more changes to make it

467
00:25:23.640 --> 00:25:27.519
<v Speaker 1>more friendly for the consumer, especially with tooling. Sometimes Visio

468
00:25:27.599 --> 00:25:31.240
<v Speaker 1>Studio also doesn't feel like picking up the generation at all,

469
00:25:31.720 --> 00:25:35.160
<v Speaker 1>and that's also very hard to deal with, so I

470
00:25:35.160 --> 00:25:37.519
<v Speaker 1>hope there will be more changes in that direction. Sadly,

471
00:25:37.559 --> 00:25:40.640
<v Speaker 1>I'm not entirely sure where the project stands right now

472
00:25:40.920 --> 00:25:44.119
<v Speaker 1>whether there are already some some enhancements in that area,

473
00:25:44.279 --> 00:25:45.799
<v Speaker 1>but I'm very much routing for it.

474
00:25:46.160 --> 00:25:48.519
<v Speaker 2>Okay, where's the best place for people to go to

475
00:25:49.039 --> 00:25:52.480
<v Speaker 2>kind of learn and get started with source code generators?

476
00:25:52.880 --> 00:25:57.160
<v Speaker 1>MSDN documentation on source code generators is already pretty good,

477
00:25:57.640 --> 00:26:01.359
<v Speaker 1>and it should definitely give a give an introduction to

478
00:26:01.480 --> 00:26:04.839
<v Speaker 1>how it works and how to set it up, and

479
00:26:04.880 --> 00:26:11.519
<v Speaker 1>then afterwards I would recommend just exploring the compilation unit

480
00:26:11.559 --> 00:26:14.519
<v Speaker 1>a bit. I think I already mentioned may it beyond

481
00:26:14.519 --> 00:26:19.319
<v Speaker 1>sharp lit bio or for example, the syntax Visualizer extension

482
00:26:19.440 --> 00:26:22.480
<v Speaker 1>for visual Studio, because that gives a lot of insights

483
00:26:22.559 --> 00:26:25.680
<v Speaker 1>into what is possible how can you get around your

484
00:26:25.799 --> 00:26:29.599
<v Speaker 1>own past coode within the generator? So these would be

485
00:26:29.720 --> 00:26:32.759
<v Speaker 1>my go to steps and how to get into the technology.

486
00:26:33.000 --> 00:26:36.880
<v Speaker 2>Okay, cool, any last things that you want to let

487
00:26:36.960 --> 00:26:38.799
<v Speaker 2>people know about before we move on to picks.

488
00:26:39.160 --> 00:26:42.119
<v Speaker 1>I think everything has been said already, so I can

489
00:26:42.160 --> 00:26:44.839
<v Speaker 1>definitely encourage people to just take a shot at it.

490
00:26:45.319 --> 00:26:48.880
<v Speaker 1>I think just getting into new technology is always very nice,

491
00:26:49.039 --> 00:26:52.160
<v Speaker 1>and this is one of those things things which feels

492
00:26:52.200 --> 00:26:55.480
<v Speaker 1>like fills a necessary gap which has just not been

493
00:26:55.519 --> 00:26:59.000
<v Speaker 1>there yet. So I think source generation has always been

494
00:26:59.079 --> 00:27:03.039
<v Speaker 1>a concern of develop us, because you know, develop us,

495
00:27:03.119 --> 00:27:06.000
<v Speaker 1>we are lazy people. We like to automate blowing stuff,

496
00:27:06.480 --> 00:27:09.799
<v Speaker 1>and so I can definitely encourage people to check it

497
00:27:09.839 --> 00:27:12.720
<v Speaker 1>out because it's it's a very nice and very convenient

498
00:27:12.880 --> 00:27:16.720
<v Speaker 1>and clean way to generate code without producing a lot

499
00:27:16.759 --> 00:27:19.720
<v Speaker 1>of garbage in your in your repository.

500
00:27:19.839 --> 00:27:22.519
<v Speaker 2>Okay, well, I definitely have a better understanding of source

501
00:27:22.559 --> 00:27:25.960
<v Speaker 2>code generators now that I've talked with you for half

502
00:27:26.000 --> 00:27:29.599
<v Speaker 2>an hour or so. So great job at explaining source

503
00:27:29.599 --> 00:27:32.119
<v Speaker 2>code generators to somebody like me. That's kind of like

504
00:27:32.279 --> 00:27:35.960
<v Speaker 2>been doing things one way forever and it's like that's

505
00:27:36.000 --> 00:27:38.079
<v Speaker 2>worked for me, so why should I do something different?

506
00:27:38.279 --> 00:27:40.880
<v Speaker 2>So good job, so now we should I'll move on

507
00:27:40.920 --> 00:27:43.200
<v Speaker 2>to picks, and I guess I'll go first with my

508
00:27:43.279 --> 00:27:46.799
<v Speaker 2>pick for for this week, and my pick is season

509
00:27:46.839 --> 00:27:49.920
<v Speaker 2>two of a show on Netflix. It's season two of

510
00:27:49.960 --> 00:27:52.759
<v Speaker 2>The Witcher. So I don't know if you have Netflix

511
00:27:52.799 --> 00:27:55.599
<v Speaker 2>or if you watch season one or familiar with the

512
00:27:55.640 --> 00:27:58.880
<v Speaker 2>things where it came from. So season two just came

513
00:27:58.920 --> 00:28:02.839
<v Speaker 2>out today. I watched it, but based upon my watching

514
00:28:02.880 --> 00:28:05.200
<v Speaker 2>of season one, I expect it to be another good season.

515
00:28:05.279 --> 00:28:08.200
<v Speaker 2>So I'll be watching that this weekend. So I'm going

516
00:28:08.279 --> 00:28:10.720
<v Speaker 2>to check out season two of The Witcher or rewatch

517
00:28:10.759 --> 00:28:13.000
<v Speaker 2>season one if you have watched it.

518
00:28:13.079 --> 00:28:16.000
<v Speaker 1>I didn't watch it yet. I actually took the hands

519
00:28:16.000 --> 00:28:18.119
<v Speaker 1>on way and play The Witch instead.

520
00:28:19.880 --> 00:28:20.920
<v Speaker 2>Did you watch season one?

521
00:28:21.119 --> 00:28:24.400
<v Speaker 1>No? Actually I did not yet. Sadly I didn't yet

522
00:28:24.480 --> 00:28:26.799
<v Speaker 1>find time to watch it, but I think now with

523
00:28:27.119 --> 00:28:30.240
<v Speaker 1>holiday break coming up, maybe I can. I can shave

524
00:28:30.319 --> 00:28:33.480
<v Speaker 1>in a few a few hours of watching The Witcher.

525
00:28:33.640 --> 00:28:35.680
<v Speaker 2>Yeah, give it a shot. Give it a shot, all right?

526
00:28:35.720 --> 00:28:37.720
<v Speaker 2>So if there's is there something that you want to

527
00:28:37.799 --> 00:28:40.400
<v Speaker 2>let our listeners know about that you're interested in and

528
00:28:40.559 --> 00:28:41.440
<v Speaker 2>want them to know about.

529
00:28:41.680 --> 00:28:44.920
<v Speaker 1>Actually, I also have a very very nice Netflix recommendation

530
00:28:45.039 --> 00:28:49.559
<v Speaker 1>I could. Yes, So I'm more of a documentation documentary watcher,

531
00:28:49.799 --> 00:28:54.119
<v Speaker 1>so I'm not very much into the movies or other

532
00:28:54.240 --> 00:28:58.079
<v Speaker 1>things like that. And I recently discovered that Explained on

533
00:28:58.160 --> 00:29:02.000
<v Speaker 1>Netflix now has some new some new episodes on Explained

534
00:29:02.359 --> 00:29:06.119
<v Speaker 1>Our Mind, and that's something I can very much recommend.

535
00:29:06.160 --> 00:29:10.640
<v Speaker 1>So I'm interested in human psychology and just how our

536
00:29:10.680 --> 00:29:13.799
<v Speaker 1>brain sometimes tends to play some tricks on us, and

537
00:29:14.200 --> 00:29:17.799
<v Speaker 1>just getting some insights into that is very cool. And

538
00:29:17.839 --> 00:29:20.720
<v Speaker 1>it's also presented in a very very nice and bite

539
00:29:20.720 --> 00:29:21.279
<v Speaker 1>sized way.

540
00:29:21.400 --> 00:29:24.119
<v Speaker 2>Okay, okay, yeah it looks good. There's three seasons of

541
00:29:24.240 --> 00:29:27.880
<v Speaker 2>Explained on Netflix. I've I think I've watched one or

542
00:29:27.880 --> 00:29:31.440
<v Speaker 2>two of them and found them interesting, but I've never

543
00:29:31.480 --> 00:29:33.839
<v Speaker 2>had much time to go back and check them out.

544
00:29:33.880 --> 00:29:36.319
<v Speaker 2>So I will see all the different things they've they've

545
00:29:36.319 --> 00:29:39.200
<v Speaker 2>came out with since last time I watch it. Great,

546
00:29:39.640 --> 00:29:42.680
<v Speaker 2>all right, Stefan. Is there some way that people can

547
00:29:42.720 --> 00:29:45.160
<v Speaker 2>reach out and ask questions of you if they need

548
00:29:45.279 --> 00:29:46.640
<v Speaker 2>the more or get in touch with you?

549
00:29:46.680 --> 00:29:50.720
<v Speaker 1>Sure? So, usually always available on get up, so get

550
00:29:50.799 --> 00:29:54.039
<v Speaker 1>up a susten diner. It's a bit hard because it's

551
00:29:54.039 --> 00:29:59.720
<v Speaker 1>a German word and there's no good pronunciation, so it's

552
00:30:00.160 --> 00:30:03.880
<v Speaker 1>O S S E N B I N d E

553
00:30:04.039 --> 00:30:07.400
<v Speaker 1>R on GitHub. And besides that, I'm also on Twitter,

554
00:30:07.640 --> 00:30:11.720
<v Speaker 1>so Twitter handle would be at dot stunts, so that's

555
00:30:11.799 --> 00:30:15.480
<v Speaker 1>at dot D O T S C h R A

556
00:30:15.680 --> 00:30:18.640
<v Speaker 1>and set. That would be probably my main channels, all.

557
00:30:18.640 --> 00:30:22.279
<v Speaker 2>Right, and that's that's Z not Z for the English speakers.

558
00:30:22.279 --> 00:30:25.000
<v Speaker 1>So yeah, exactly.

559
00:30:24.640 --> 00:30:26.640
<v Speaker 2>Yeah, I got it, got it, got it all right? Great?

560
00:30:26.960 --> 00:30:29.200
<v Speaker 2>Thanks the fon for coming on the show. Glad got

561
00:30:29.240 --> 00:30:31.960
<v Speaker 2>to have you here today. Thanks if our listeners. Do

562
00:30:31.960 --> 00:30:33.200
<v Speaker 2>you want to reach out and get in touch with

563
00:30:33.240 --> 00:30:34.799
<v Speaker 2>the show. We'd love to hear from you. We would

564
00:30:34.880 --> 00:30:37.519
<v Speaker 2>like to know what we're doing wrong, what we could

565
00:30:37.559 --> 00:30:39.759
<v Speaker 2>do better, and what kind of topics you would like

566
00:30:39.799 --> 00:30:41.839
<v Speaker 2>to hear about, So you get touch with me. I

567
00:30:41.880 --> 00:30:45.480
<v Speaker 2>am on Twitter, I am at dot net superhero, and

568
00:30:45.519 --> 00:30:48.119
<v Speaker 2>nobody else is here to go, So I'll do it

569
00:30:48.759 --> 00:30:51.319
<v Speaker 2>all right, thanks to fun again, and we'll catch everybody

570
00:30:51.319 --> 00:30:54.480
<v Speaker 2>else on the next episode of Adventures in dot Net.
