Asynchronous 是否有支持隐式异步编程的语言、编译器或运行时

Asynchronous 是否有支持隐式异步编程的语言、编译器或运行时,asynchronous,Asynchronous,是否有任何编译器或运行时支持或计划支持隐式异步编程 比如说 public List<Product> findProductByIdWithSOsAndPOs(int id){ //The next 3 tasks can be done in asynchronously //task 1.a may take a while Product product = productRepo.findById(id); //task 1.b may take

是否有任何编译器或运行时支持或计划支持隐式异步编程

比如说

public List<Product> findProductByIdWithSOsAndPOs(int id){

   //The next 3 tasks can be done in asynchronously

   //task 1.a may take a while
   Product product = productRepo.findById(id);

   //task 1.b may take a while
   List<SalesOrder> salesOrders = salesOrderRepository.findAllByProductId(id);

   //task 1.c may take a while
   List<PurchaseOrder> purchaseOrders = purchaseOrderRepository.findAllByProductId(id);

   //the runtime is smart enough to know that this task depends
   //on the previous 3 (1.a, 1.b and 1.c) and won't perform this
   //until they are complete without any special syntax (await, 
   //wrapping in future.map, callbacks, etc.)
   //task 2
   Product productWithSOsAndPOs = new Product(product.id, product.name, salesOrders, purchaseOrders);

   //the runtime is also smart enough until all the tasks are complete
   //task 3
   return productWithSOsAndPOs;
}
public List findproductbyid和osandpos(int-id){
//接下来的3个任务可以异步完成
//任务1.a可能需要一段时间
Product Product=productRepo.findById(id);
//任务1.b可能需要一段时间
List salesOrders=salesOrderRepository.findAllByProductId(id);
//任务1.c可能需要一段时间
List purchaseOrders=purchaseOrderRepository.findAllByProductId(id);
//运行时足够聪明,可以知道此任务取决于
//在前面的3(1.a、1.b和1.c)中,并且不会执行此操作
//直到它们在没有任何特殊语法的情况下完成(等待,
//包装在future.map、回调等中)
//任务2
Product productWithSOsAndPOs=新产品(Product.id、Product.name、salesOrders、purchaseOrders);
//在所有任务完成之前,运行时也足够智能
//任务3
退货产品,包括销售订单和销售订单;
}

在.NET中,Tasks.Parallel库使事情变得非常自然。总是会涉及到某种程度的语法,但这只是一个领域。并行编程可能很棘手,编译器不能总是准确地告诉您正在做什么,特别是当涉及多个线程时。在数据层上使用Entity Framework确实可以让事情变得简单,因为异步调用是为您生成的。

不清楚您到底想要什么,请用您自己的话解释您想要什么。上面是C#,所以我假设在Windows上?CLR已经有多种方法来完成异步任务和并行编程。它可以是C#或Java。我试着尽量通俗易懂。我并不真正关心语言。我想问的是,是否有一种语言可以在没有任何特殊语法的情况下进行异步编程。例如,我相信在C#中,您会使用async/await,但运行时可以通过上下文来判断您试图并行运行的内容。有些语言将并行编程作为一级概念。每样东西都会有“某种程度”的语法。你能列出一些吗?@decapo请查看一个启动点(忽略那些明显不符合要求的)和。我记不起和我的朋友一起工作的那个人的名字(当时很学术),但他也做过Charm++的工作。谢谢。这不是我真正想要的。在环顾四周之后,我认为没有人在做我所要求的事情,我认为这就是为什么很难表达的原因。我上面写的代码是阻塞上下文中的有效代码(即,如果一切正常,它将返回一个结果)。但是,在非阻塞环境中,此代码可能不会返回结果。您必须添加额外的代码,如“wait”,以便它可靠地工作,但当我阅读代码时,我可以理解需要运行什么并等待结果。我想问的是,是否有任何语言/编译器/运行时在本机上支持这一点。