News for hackers. Stuff that matters.
Re:Cap'n Web: a new RPC system for browsers and web servers by javier2 on Monday September 22, 2025 @04:57PM (#45339355)
It dont think C# looks at the code? I suspect it can track that you called p.Name, then generate sql with this information?
Re:Cap'n Web: a new RPC system for browsers and web servers by adzm on Monday September 22, 2025 @05:01PM (#45339397)
The lambda is converted into an Expression, basically a syntax tree, which is then analyzed to see what is accessed.
Re:Cap'n Web: a new RPC system for browsers and web servers by javier2 on Wednesday September 24, 2025 @05:33AM (#45358057)
Ok, so its a step in the compile that rewrites and analyzes it?
Re:Cap'n Web: a new RPC system for browsers and web servers by adzm on Wednesday September 24, 2025 @10:12PM (#45368548)
It's actually really neat. Normally a lambda would just be a function but if it gets cast to an Expression then you get the AST at runtime. Entity Framework analyzes these at runtime to generate the SQL and logic/mapping etc. You can get the AST at compile time in some situations with a Roslyn plug-in or etc I believe as well.
Re:Cap'n Web: a new RPC system for browsers and web servers by ziml77 on Monday September 22, 2025 @06:11PM (#45340228)
The C# compiler is looking at that code. It sees that the lambda is being passed into a function which accepts an Expression as a parameter, so it compiles the lambda as an expression tree rather than behaving like it's a normal delegate.