Что такое первый класс язык.NET?

Вы можете использовать следующий код:

function isTouchDevice() {
   var el = document.createElement('div');
   el.setAttribute('ongesturestart', 'return;'); // or try "ontouchstart"
   return typeof el.ongesturestart === "function";
}

Источник: Обнаружение сенсорного просмотра и @mplungjan post .

Вышеупомянутое решение было основано на обнаружении поддержки событий без перехвата браузера статья.

Вы можете проверить результаты на следующей тестовой странице .

Обратите внимание, что приведенный выше код проверяет только наличие поддержки сенсорного экрана в браузере, а не на устройстве. Так что если у вас ноутбук с сенсорным экраном, ваш браузер может не иметь поддержки сенсорных событий. Недавний Chrome поддерживает сенсорные события , но другой браузер может этого не делать.

Вы также можете попробовать:

if (document.documentElement.ontouchmove) {
  // ...
}

, но это может не работать на устройствах iPhone.

8
задан jpoh 25 June 2009 в 10:19
поделиться

8 ответов

Describing a language as a first class .NET language is a subjective description. It refers to a .NET language which supports all of the .NET CLR features (in the real world I belive that this means it supports most of the features).

It has also traditionaly been used to describe a language that helps to shape the .NET CLR, meaning that I doubt Wasabi is a true first class language.


Update

Quote from an article describing how F# is a first class .NET language.

"This means that F# runs on the CLR, embraces object-oriented programming, and has features to ensure a smooth integration with the .NET Framework."

5
ответ дан 5 December 2019 в 11:26
поделиться

As has been mentioned a couple of times there is no official definition, but a 1st class .NET language is essentially one that can create CLS-compliant assemblies as well as consume them.

If you're bored and want to read the ECMA CLI specifications then you'll find they distinguish between CLS Frameworks (CLS-compliant assemblies), CLS Consumers (compilers that can consume CLS Frameworks) and CLS Extenders (compilers that can create CLS Frameworks).

In CLI specification speak a 1st class .NET language is therefore a language whose compiler can act as a CLS Consumer and a CLS Extender.

2
ответ дан 5 December 2019 в 11:26
поделиться

As far as I know, there is no clear definition of "first class .NET language". I think it simply refers to those languages that support most of the features offered by the CLR.

3
ответ дан 5 December 2019 в 11:26
поделиться

"First class .NET language" is not an official term.

Officially, a language can be Common Language Specification (CLS)-compliant and thus be able to interoperate with other CLS-compliant languages.

(Note: Of course, being CLS-compliant is a property of the software you write, and thus, of the assembly you produce. A CLI language will let you write CLS-compliant code, but will not force you to do so. You can write a non-CLS compliant assembly in C#, for example by using unsigned types in its public API.)

However, since (again) there is no official definition for "first-class .NET language", some people may not consider that they're working in a "first-class" .NET language unless they can use WPF or (tomorrow) Code Contracts, which is clearly much more demanding than the CLS-compliance requirement.

3
ответ дан 5 December 2019 в 11:26
поделиться

part from ILAsm no .NET language supports all features of the CLR

In my book, a first class language is a language that compiles down to IL and produces verifiable code i.e. you can disassemble the assembly back to the original code for instance using Reflector ("round-tripping").

1
ответ дан 5 December 2019 в 11:26
поделиться

Я бы понял, что это означает «компилируется непосредственно в байт-код .NET» (а не генерирует код в C #), а также что он может использовать стандартные библиотеки .NET.

0
ответ дан 5 December 2019 в 11:26
поделиться

It means it is fully supported by the .net and conversely supports all of .nets features. There are no limitations imposed on it. Anything that can be done in one "first class language" can be done equally well in another.

C#, VB.net, IronPython etc are all first class languages. XAML however is not. It is used in parts of .net, but you certainly couldn't do everything in it.

1
ответ дан 5 December 2019 в 11:26
поделиться

Я думаю, что в этом контексте это означало не только наличие компилятора wasabi для IL, но также наличие поддержки Visual Studio / инструмента.

Это также может означать, что типы и т.д. - это все типы .Net, а не сопоставление с объектами эквивалентов .Net во время компиляции?

Я полагаю, что язык первого класса традиционно имел бы все игрушки (отражение, генерация кода и т.д.), где второй класс может компилироваться в IL , и не более того.

0
ответ дан 5 December 2019 в 11:26
поделиться
Другие вопросы по тегам:

Похожие вопросы: