inline

How to check if a function's type parameters are statically resolved?

白昼怎懂夜的黑 提交于 2019-12-22 09:48:19
问题 very simple examples: let myfun x = x Here in the intellisense it says "x: 'a -> 'a". In the FSI it says "x: 'a -> 'a" let inline myfun x = x Here in the intellisense it says "x: 'a -> 'a". In the FSI it says "x: 'a -> 'a" <<<< why not ^a ? let inline myfun (x: 'b) = x Here in the intellisense it says "x: 'b -> 'b". In the FSI it says "x: 'b -> 'b" let inline myfun (x: ^b) = x Here in the intellisense it says "x: 'b -> 'b". In the FSI it says "x: ^b -> ^b" <<<< different Since the

Inline MSIL/CIL

二次信任 提交于 2019-12-22 08:55:07
问题 I created following simple method: public static void Main () { Console.WriteLine("Hello world!"); Console.ReadKey(true); } Then I used ILSpy to get the MSIL code: .method public hidebysig static void Main() cil managed { .entrypoint .maxstack 8 nop ldstr "Hello world!" call void [mscorlib]System.Console::WriteLine(string) nop ldc.i4.1 call valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console::ReadKey(bool) pop ret } Finally I tried to write the MSIL code into my C# code using

Inline MSIL/CIL

你说的曾经没有我的故事 提交于 2019-12-22 08:54:02
问题 I created following simple method: public static void Main () { Console.WriteLine("Hello world!"); Console.ReadKey(true); } Then I used ILSpy to get the MSIL code: .method public hidebysig static void Main() cil managed { .entrypoint .maxstack 8 nop ldstr "Hello world!" call void [mscorlib]System.Console::WriteLine(string) nop ldc.i4.1 call valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console::ReadKey(bool) pop ret } Finally I tried to write the MSIL code into my C# code using

Why aren't Automatic Properties inlined by default?

爷,独闯天下 提交于 2019-12-22 08:45:03
问题 Being that properties are just methods under the hood, it's understandable that the performance of any logic they might perform may or may not improve performance - so it's understandable why the JIT needs to check if methods are worth inlining. Automatic properties however (as far as I understand) cannot have any logic, and simply return or set the value of the underlying field. As far as I know, automatic properties are treated by the Compiler and the JIT just like any other methods.

How can I inline the receiver parameter of an extension function in Kotlin?

删除回忆录丶 提交于 2019-12-22 08:29:26
问题 Inspired by this question, I was thinking about how could one inline the receiver parameter of an extension function? In theory, like this: inline fun <T> not(crossinline predicate : (T) -> Boolean) = { e : T -> !predicate(e) } Just that predicate becomes our receiver function: operator inline fun <T> ((T) -> Boolean).not() = { e : T -> !this(e) } Now, for the above code, I'd expect the compiler to complain that it needs crossinline ; however, I get the following warning: Warning: Expected

Will C# inline methods that are declared in interfaces?

ⅰ亾dé卋堺 提交于 2019-12-22 07:57:08
问题 If I have an interface: interface IMyInterface { void DoSomething(); } And an implementing class: class MyClass : IMyInterface { public void DoSomething() { } } Is DoSomething a candidate for inlining? I'd expect "no" because if it's an interface then the object may be cast as a IMyInterface, so the actual method being called is unknown. But then the fact that it's not marked as virtual implies it may not be on the vtable, so if the object is cast as MyClass, then maybe it could be inlined?

Inline contenteditable tags fail to align correctly in IE

你离开我真会死。 提交于 2019-12-22 06:46:46
问题 I have a situation where I have inline contenteditable span tags together with other non-contenteditable tags which work fine in all browsers except for IE. In IE the tags fail to act as inline and start forcibly aligning themselves as block (sort of). I need something to make them act as inline. It seems that IE is forcing some weird behaviour when the tag is contentedtiable. <div class="container"> <span class="text" contenteditable="true">Lorem ipsum dolor </span> <span class="tag">Tag<

ASP.NET - Inline vs. Code-Behind

。_饼干妹妹 提交于 2019-12-22 06:01:27
问题 I realize that by asking this question, I could have started the apocalypse, but a colleague of mine uses a lot of inline coding in their aspx pages, where as I prefer using the code-behind. Is there a right and a wrong way here? 回答1: Not unless your coding standard says otherwise. IMO code-behind helps separation of concerns, so I prefer that, but sometimes just dealing with one file is nice too. 回答2: Code-behind is the more traditional and logical place. If it works, it works, but I can't

ASP.NET - Inline vs. Code-Behind

随声附和 提交于 2019-12-22 06:01:11
问题 I realize that by asking this question, I could have started the apocalypse, but a colleague of mine uses a lot of inline coding in their aspx pages, where as I prefer using the code-behind. Is there a right and a wrong way here? 回答1: Not unless your coding standard says otherwise. IMO code-behind helps separation of concerns, so I prefer that, but sometimes just dealing with one file is nice too. 回答2: Code-behind is the more traditional and logical place. If it works, it works, but I can't

jQuery - Calling a function inline

纵然是瞬间 提交于 2019-12-22 06:00:24
问题 I am trying to pass one variable to a jQuery function inline (ie: using an onMouseOver="function();" within the actual link (which is an area tag from an image map)). The function is only being called if I place it before the $(document).ready(function(){ line, but doing this is causing all sorts of problems with jQuery. All I want is for a simple tag (such as <area shape="circle" coords="357,138,17" onMouseOver="change('5');" id="5" /> to launch a function that is contained within the normal